Miscellany
public text v1 · immutableclass MyInt2(int):
__slots__ = ['oid']
oid = 20
def __init__(self, orig, oid=None):
int.__init__(self, orig)
self.oid = oid
int2 = MyInt2(2000, oid=10)
print int2
print int2.oid
Lanza el error:
[eroldan@dedo k3]$ python test.py
Traceback (most recent call last):
File "test.py", line 8, in ?
int2 = MyInt2(2000, oid=10)
TypeError: 'oid' is an invalid keyword argument for this function