Re: class method question

2006-10-25 Thread Bruno Desthuilliers
Sylvain Ferriol wrote: > hello > can you explain why python does not see difference between instance > method and class method, having the same name Because class namespaces are dicts, and you can't have duplicate keys in dicts. It's totally unrelated to class/instance method distinction (try with

Re: class method question

2006-10-25 Thread Fredrik Lundh
Sylvain Ferriol wrote: > can you explain why python does not see difference between instance > method and class method, having the same name You're trying to put two objects with the same name in the same namespace. > example > >>> class toto(object): > ... def f(self): > ... p

class method question

2006-10-25 Thread Sylvain Ferriol
hello can you explain why python does not see difference between instance method and class method, having the same name example >>> class toto(object): ... def f(self): ... print('instance method') ... @classmethod ... def f(cls): ... print('class method') ...