Best practice for object attributes?
laotseu
bdesth at removethis.free.fr
Wed Apr 2 10:31:53 EST 2003
More information about the Python-list mailing list
Wed Apr 2 10:31:53 EST 2003
- Previous message (by thread): Best practice for object attributes?
- Next message (by thread): Best practice for object attributes?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Jp Calderone wrote: > On Wed, Apr 02, 2003 at 04:12:36PM +0100, Michael Sparks wrote: > >>[snip] >> >> >>As far as I can tell the behaviour seems to be that you automatically >>gain instance attributes that clone the state of the class attributes >>at object creation time, which are then independent and can be modified >>via the usual self.<attr> syntax later on. (They cannot however be >>modified via the self.__dict__[<attr>] syntax since they're not stored >>there) >> > > > Not quite. What really happens is simpler. When an attribute lookup on > an instance fails, the lookup proceeds to the instance's class object (if it > fails there, it proceeds to the class object's bases, and so on). The > attributes aren't cloned, and the time of creation matters not. Of course.... thought I had a brain, but it seems I can't find it today. Someone seen my brain 'round here ? Laotseu
- Previous message (by thread): Best practice for object attributes?
- Next message (by thread): Best practice for object attributes?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list