built-in 'property'
Steven Bethard
steven.bethard at gmail.com
Tue Dec 28 13:14:24 EST 2004
More information about the Python-list mailing list
Tue Dec 28 13:14:24 EST 2004
- Previous message (by thread): built-in 'property'
- Next message (by thread): built-in 'property'
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Steven Bethard wrote: > I seem to be missing some of the messages on this thread, but while > we're talking about properties, it's probably instructive to remind > people that the functions passed to the property function are not > redefinable in subclasses: > > py> class D(C): > ... def getx(self): > ... return 42 > ... > py> D(5).x > 5 Oops, sorry! Bad copy-paste! No biscuit! Ignore the code above here. Important code is below: > py> class C(object): > ... def getx(self): > ... return 1 > ... x = property(getx) > ... > py> class D(C): > ... def getx(self): > ... return 42 > ... > py> C().x > 1 > py> D().x > 1 Steve
- Previous message (by thread): built-in 'property'
- Next message (by thread): built-in 'property'
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list