Setter Propertys' mro?

cipher cipherzero at gmail.com
Sun Sep 7 00:50:47 EDT 2008


On Sep 6, 9:10 pm, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> On Sat, 06 Sep 2008 18:15:33 -0700, cipher wrote:
> > Whats the mro (method resolution order) of a setter property (__set__ on
> > a descriptor).
> > i seem to be experiencing some weird issue with them. for example
>
> >>>> class test:
>
> Unless you're using Python 3, there's your problem right there. In Python
> 2.x, properties only work correctly for new style classes, not classic
> classes. Change the above line to:
>
> class Test(object):  # by convention, classes start with Uppercase.
>
> and all should work (or at least you'll discover new and exciting
> different problems with your code).
>
> > however, if i specify the metaclass in the class definition it works
> > just fine...
>
> > class test:
> >  __metaclass__=type
>
> which is more or less the same as inheriting from object, except uglier.
>
> --
> Steven

Thanks to both of you!! that solved it.
i wonder why the getters would work fine though??
neways, wtf do i care :)


again, thank you both.

__
Cipher




More information about the Python-list mailing list