Attribute definition, WHY?
Rainer Deyke
root at rainerdeyke.com
Wed Sep 13 01:05:46 EDT 2000
More information about the Python-list mailing list
Wed Sep 13 01:05:46 EDT 2000
- Previous message (by thread): Bug in Python/C API?
- Next message (by thread): Attribute definition, WHY?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
<bragib at my-deja.com> wrote in message news:8ploet$ucg$1 at nnrp1.deja.com... > 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? Yes: efficiency. Also, the ability to override at the subclass level without replacing __init__. -- Rainer Deyke (root at rainerdeyke.com) Shareware computer games - http://rainerdeyke.com "In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor
- Previous message (by thread): Bug in Python/C API?
- Next message (by thread): Attribute definition, WHY?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list