Attribute definition, WHY?

bragib at my-deja.com bragib at my-deja.com
Tue Sep 12 13:17:42 EDT 2000


Why would you want to do the following:

class A:
   attr1 = [1,2]
   def __init__(self,name):
       self.name = name

and not

class A:
   def __init__(self,name):
       self.name = name
       self.attr1 = [1,2]

Are there benefits to the first definition?

Bragi


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list