@property decorator doesn't raise exceptions

Rafe rafesacks at gmail.com
Fri Oct 24 18:34:36 CEST 2008


On Oct 24, 2:21 am, Christian Heimes <li... at cheimes.de> wrote:
> Rafewrote:
> > Hi,
>
> > I've encountered a problem which is making debugging less obvious than
> > it should be. The @property decorator doesn't always raise exceptions.
> > It seems like it is bound to the class but ignored when called. I can
> > see the attribute using dir(self.__class__) on an instance, but when
> > called, python enters __getattr__. If I correct the bug, the attribute
> > calls work as expected and do not call __getattr__.
>
> > I can't seem to make a simple repro. Can anyone offer any clues as to
> > what might cause this so I can try to prove it?
>
> You must subclass from "object" to get a new style class. properties
> don't work correctly on old style classes.
>
> Christian

All classes are a sub-class of object. Any other ideas?

- Rafe



More information about the Python-list mailing list