This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Property accessor/getter called twice
Type: behavior Stage:
Components: Versions: Python 2.5
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: mliddle, rhettinger
Priority: normal Keywords:

Created on 2009-11-22 08:14 by mliddle, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg95595 - (view) Author: Michal Liddle (mliddle) Date: 2009-11-22 08:14
The following snippet demonstrates the problem:

-------------------------------------
class Test(object):
    def get(self):
        print "get"
    def set(self, v):
        print "set"
    test = property(get, set)

t = Test()
t.test
t.test = 3
-----------------------------------

"get" is printed twice (expected once?), "set" is printed only once (as
expected)
msg95596 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2009-11-22 08:41
Tried your snippet with both py2.5 and py2.6.  It works as expected (one
get and one set).
msg95598 - (view) Author: Michal Liddle (mliddle) Date: 2009-11-22 13:01
Right you are. Looks like its actually an IPython specific behaviour
here (didn't think to check that in the first place, sorry).
History
Date User Action Args
2022-04-11 14:56:55adminsetgithub: 51623
2009-11-22 13:01:29mliddlesetmessages: + msg95598
2009-11-22 08:41:30rhettingersetstatus: open -> closed

nosy: + rhettinger
messages: + msg95596

resolution: works for me
2009-11-22 08:14:57mliddlecreate