469,338 Members | 8,326 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,338 developers. It's quick & easy.

Overwrite only one function with property()

Hi list!
It is possible to overwrite only one function with the property-function?

x = property(getx, setx, delx, 'doc')

I just want to overwrite setx, but when I set the others to None,
I can't read and del the member. Any ideas or is this not possible?

Thank you!
Kai
Nov 18 '06 #1
3 1817
Kai Kuehne wrote:
Hi list!
It is possible to overwrite only one function with the property-function?

x = property(getx, setx, delx, 'doc')

I just want to overwrite setx, but when I set the others to None,
I can't read and del the member. Any ideas or is this not possible?
There are no default functions for getx, setx, delx; you have to
specify what you expect to happen when you write a.p, a.p = v and del
a.p, respectively. What would, for example, be the default getx that
you don't want to overwrite ?

George

Nov 18 '06 #2
On 18 nov, 19:06, "Kai Kuehne" <kai.kue...@gmail.comwrote:
It is possible to overwrite only one function with the property-function?

x = property(getx, setx, delx, 'doc')

I just want to overwrite setx, but when I set the others to None,
I can't read and del the member. Any ideas or is this not possible?
Do you want to override the setter of an existing property, in a
derived class?

Nov 18 '06 #3
Kai Kuehne a écrit :
Hi list!
It is possible to overwrite only one function with the property-function?
property is not function, it's a class. And it doesn't "overwrite" anything.
x = property(getx, setx, delx, 'doc')

I just want to overwrite setx, but when I set the others to None,
I can't read and del the member.
You don't "overwrite" setx, you pass it as an argument to the property
constructor call.
Any ideas or is this not possible?
Read this, and you'll have a detailed answer:
http://users.rcn.com/python/download/Descriptor.htm

Thank you!
Kai
Nov 19 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by David Baumgarten | last post: by
1 post views Thread by Björn Langhof | last post: by
2 posts views Thread by hzgt9b | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by Purva khokhar | last post: by
1 post views Thread by haryvincent176 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.