Trouble with property

Gabriel Genellina gagsl-py at yahoo.com.ar
Tue Oct 24 03:16:58 CEST 2006


At Monday 23/10/2006 20:28, Odalrick wrote:

>I'm having some trouble with using property. This class is supposed to
>represent a rectangle that can never be outside an area.
>
>class ConstrainedBox:
># The property that is causing grief
>         linear_size = property( _get_linear_size, _set_linear_size )
>
>By adding some logging I found out that _set_linear_size never is
>called, so the rectangle remains the default size forever.

You must use a new-style class for properties to work. That is: class 
ConstrainedBox(object):

-- 
Gabriel Genellina
Softlab SRL 

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar



More information about the Python-list mailing list