473,372 Members | 898 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,372 software developers and data experts.

list property fires get on append

I've created a class that has a property which points at a private
list. When I try to use the append() function on this list property,
the fget method is fired rather than the fset method. If I directly
set my property to a literal list, the set method fires.

Here's a stripped down version of my code:

class Hierarchy(object):
_children = []

def __init__(self):

def get_children(self):
return self._children

def set_children(self, value):
self._children = value

children = property(get_children, set_children)


import Hierarchy
hierarchy = Hierarchy.Hierarchy()
# this fires a get for some reason
hierarchy.children.append( Hierarchy.Hierarchy())
# this fires a set as expected
hierarchy.children = [Hierarchy.Hierarchy()]


it prints:

Jan 6 '08 #1
0 842

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Martin Christensen | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Howdy! Suppose I have a list A containing elements that I want to put into list B if they satisfy some property. The obvious way of doing it...
by: Chicken Kebab Abdullah | last post by:
I am making a database of my movie collection and I have a form which Shows a DVD Code in a combo, and a list of the divx movies on the dvd on the right in a list box. The combo boxes bound...
by: Dave Hopper | last post by:
Hi I posted a question recently regarding problems I am having getting a value from a list box to use in a query. I got a lot of help, for which I thank you and it's nearly working! But I need...
by: Timo | last post by:
I am trying to use the DropDownList_SelectedIndexChanged event on a dropdown which is dynamically populated with different values at runtime, depending on what the user has been doing. The dropdown...
by: Mark | last post by:
I have two dropdown lists. Both have autopostback set to true. In both dropdowns, when you select an item from the list, it redirects to the Value property of the dropdown. Nothing fancy. ...
by: Scott K | last post by:
I have a datalist which has an edititem template. When the user is in edit mode (of the datalist) it shows a couple of text boxes for editing as well as a drop down list box and has a label...
by: Lonnie Princehouse | last post by:
Here's a curious hack I want to put up for discussion. I'm thinking of writing a PEP for it. Observation ----------------- I found myself using this construct for assembling multiple lists: ...
by: David Veeneman | last post by:
This posting is for the Google crawler and requires no response. I have created a multi-level object hierarchy, in which the root object needs to be notified whenever any property of any object...
by: Lespaul36 | last post by:
I have a control that I have made that uses a custom class for storage of some of the information. I want it to display in the VS.Net 2003 property grid in the IDE like the Font property does, so...
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...
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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$) { } ...
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...
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
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.