[Python-ideas] @classproperty, @abc.abstractclasspropery, etc.

Dirkjan Ochtman dirkjan at ochtman.nl
Mon Jan 3 22:22:14 CET 2011


On Mon, Jan 3, 2011 at 22:09, K. Richard Pixley <rich at noir.com> wrote:
> I think the meanings of the new ones are pretty straightforward, but in case they are not...
>
> @staticproperty - like @property only without an implicit first argument.  Allows the property to be called directly from the class without requiring a throw-away instance.
>
> @classproperty - like @property, only the implicit first argument to the method is the class.  Allows the property to be called directly from the class without requiring a throw-away instance.
>
> @abc.abstractattribute - a simple, non-callable variable that must be overridden in subclasses
>
> @abc.abstractstaticproperty - like @abc.abstractproperty only for @staticproperty
>
> @abc.abstractclassproperty - like @abc.abstractproperty only for @classproperty

Do you have actual use cases for these?

Cheers,

Dirkjan



More information about the Python-ideas mailing list