Eric J. Van der Velden wrote:
Hello,

I have,

class C:
        n=0
        def __init__(s):
                __class__.n+=1


Should be

class C:
   n = 0
   def __init__(self):
      self.__class__.n+=1
C.n+=1 # equivalent to this line (I prefer this one, more readable, less refactor-friendly)

 @classmethod
 def p(cls):
   print(cls.n)

JM


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

Reply via email to