Attribute definition, WHY?

bragib at my-deja.com bragib at my-deja.com
Tue Sep 12 19:17:42 CEST 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