By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,427 Members | 1,356 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,427 IT Pros & Developers. It's quick & easy.

Overwrite only one function with property()

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.