In [1]:
import math
In [2]:
math.pow?
In [3]:
math.pow(2,10)
Out[3]:
In [4]:
class Pessoa(object):
In [5]:
class Numero(object):
def __init__(self, x):
self.numero = x
def __add__(self, other):
return self.numero + other
In [6]:
n = Numero(4)
In [7]:
n + 5
Out[7]:
In [8]:
class Pessoa(object):
def __init__(self, nome):
self.nome = nome
def __call__(self):
print(self.nome)
In [9]:
p = Pessoa('Rodolfo')
In [10]:
p.nome
Out[10]:
In [11]:
p()
In [ ]: