473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 1954
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Gord | last post by:
Hello, If you set the flag for an overwrite prompt using the 'Save' common dialog, how do you read the response when the user clicks the Yes or No in the 'overwrite' message box? Everything...
2
by: chris | last post by:
hi, i am tinkering with properties of new style classes: class Base(object): def m(self): return 'p of Base' p = property(m) class Sub(Base):
3
by: David Baumgarten | last post by:
I am trying to download a file from a ftp server and if the file already exists to overwrite it. Here is my code: FtpGetFile(hConnection, "1.pdf", FLocation & "\Temp\" & "1.pdf", False, 1, 0,...
11
by: Florian Loitsch | last post by:
I'm currently writing a JS->Scheme compiler (which, using Bigloo, automatically yields a JS->C, JS->JVM, JS->.NET compiler), and have a question concerning the function-parameters: According to...
6
by: deko | last post by:
Is there a way to set a custom property on Access tables and/or queries to prevent them from being overwritten by import wizards? Any Access database can be easily destroyed if a user mistakenly...
10
by: lgbjr | last post by:
Hi All, In VB.Net how do I determine if CapsLock is on/off (same for NumLock) and whether the input mode is set to Insert or Overwrite (Insert Key). I just added a status bar to my app, and I...
3
by: Developer | last post by:
I use the RichTextBox and sometimes put it into overwrite mode. I'd like the cursor to show whether its in overwrite or insert mode. I often use Cursor.Current = Cursors.WaitCursor and...
1
by: Björn Langhof | last post by:
Hello. I'd like to overwrite a native function. It's the reload()-function of the document.location-object. My idea: document.location.reload = function(){alert('foo')}; So if the function...
2
by: hzgt9b | last post by:
I know how to overwrite a function. Normally this is what I would do: function someFunction() { /* orig definition here */ } //later in the execution stream I would do... someFunction = function...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.