John Fouhy wrote:
> On 09/11/05, Roy Bleasdale <[EMAIL PROTECTED]> wrote:
> 
>>I have created a List within a class. If I try and append to the list using
>>the set function using the property value my variable stops being a list.
> 
> Properties only work properly with new style classes.  You get a new
> style class by inheriting from another new style class, or by
> inheriting from object.
> 
> Try changing the first line to "class ShoppingBag(object):".

Also you should use different names for the instance attributes (e.g. 
self.fruit) and the class properties (ShoppingBag.fruit). The usual convention 
is to prefix the attribute names with an underscore (self._fruit). If you use 
the same name the instance attribute will not be accessible - the property has 
priority (unlike most attribute lookups where an instance attribute will be 
found first).

Kent

-- 
http://www.kentsjohnson.com

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to