Re: Really virtual properties

2005-08-18 Thread Steven Bethard
Ben Finney wrote: > Not using the built-in property type. Here is a recipe for a > LateBindingProperty that does what you ask: > > Steven Bethard: > "This recipe provides a LateBindingProperty callable which allows > the getter and setter methods associated with the property to be >

Re: Really virtual properties

2005-08-18 Thread Bengt Richter
On Thu, 18 Aug 2005 23:36:58 +0200, Torsten Bronger <[EMAIL PROTECTED]> wrote: >Hallöchen! > >When I use properties in new style classes, I usually pass get/set >methods to property(), like this: > >x = property(get_x) > >If I overwrite get_x in a derived class, any access to x still calls >t

Re: Really virtual properties

2005-08-18 Thread Ben Finney
Torsten Bronger <[EMAIL PROTECTED]> wrote: > Hallöchen! > > When I use properties in new style classes, I usually pass get/set > methods to property(), like this: > > x = property(get_x) Better is to make it clear that 'get_x' is not intended to be called directly. You can do this through th

Re: Really virtual properties

2005-08-18 Thread Diez B. Roggisch
I don't think so - the reason is that property() is evaluated in the baseclass, and stores a callable, not a name. the only thing you could do is either - create a level of indirection, using lambda, to force the lookup: x = property(lamda self: self.get_x()) - use a metaclass, that tries to

Re: Really virtual properties

2005-08-18 Thread Diez B. Roggisch
I don't think so - the reason is that property() is evaluated in the baseclass, and stores a callable, not a name. the only thing you could do is either - create a level of indirection, using lambda, to force the lookup: x = property(lamda self: self.get_x()) - use a metaclass, that tries to