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')
...
 >>> t=toto()
 >>> t.f
<bound method type.f of <class '__main__.toto'>>
 >>> t.f()
class method
 >>> toto.f()
class method


if i do the same in ruby:
"""
class Toto
   def meth
     print "instance method\n"
   end

   def Toto.meth
     print "class method\n"
   end
end

i = Toto.new
i.meth
Toto.meth
"""

$> ruby1.9 test_classmethod.rb
instance method
class method

thanks
sylvain
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to