R
Ruediger
Hello!
Executing following little program gives me an TypeError.
What makes me wonder is that foo does get an argument passed while bar
doesn't. Can anyone explain why??????
Thanks
Ruediger
class foo(list):
__hash__ = lambda x: id(x)
class bar(list):
__hash__ = id
_s_ = set()
_s_.add(foo())
_s_.add(bar())
rue@linux:~> python test01.py
Traceback (most recent call last):
File "test01.py", line 9, in <module>
_s_.add(bar())
TypeError: id() takes exactly one argument (0 given)
Executing following little program gives me an TypeError.
What makes me wonder is that foo does get an argument passed while bar
doesn't. Can anyone explain why??????
Thanks
Ruediger
class foo(list):
__hash__ = lambda x: id(x)
class bar(list):
__hash__ = id
_s_ = set()
_s_.add(foo())
_s_.add(bar())
rue@linux:~> python test01.py
Traceback (most recent call last):
File "test01.py", line 9, in <module>
_s_.add(bar())
TypeError: id() takes exactly one argument (0 given)