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

K. Richard Pixley rich at noir.com
Tue Jan 4 18:44:30 CET 2011


On 1/4/11 07:23 , Mike Graham wrote:
> On Mon, Jan 3, 2011 at 4:09 PM, K. Richard Pixley <rich at noir.com 
> <mailto:rich at noir.com>> wrote:
>
>     Essentially the permutation are, I think:
>     {'unadorned'|abc.abstract}{'normal'|static|class}{method|property|non-callable
>     attribute}.
>
>
> At the abstract level, a property and a normal, non-callable attribute 
> are the same thing.
They are from the instantiation perspective but not from the subclassing 
perspective.  From the subclassing perspective, it's the difference between:

class Foo(object):
     @property
     def bar(self):
         ...

and:

class Foo(object):
     bar = ...

If an abstract property were to be answered by a simple assignment, then 
the "read-only" trait would be lost.

--rich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110104/8b673376/attachment.html>


More information about the Python-ideas mailing list