[Python-ideas] Define a method or function attribute outside of a class with the dot operator

Barry Warsaw barry at python.org
Tue Feb 14 16:34:09 EST 2017


On Feb 14, 2017, at 12:48 PM, Steven D'Aprano wrote:

>On Fri, Feb 10, 2017 at 09:05:49PM -0500, Terry Reedy wrote:
>> Saving about 10 keystrokes is close to trivial.  
>
>The same argument can be made for @decorator syntax.
>
>And, if I understand correctly, the same argument *was* made against
>decorator syntax: that it was trivial, unnecessary and confusing.

Well, not exactly.  Remember that the semantics, and common decorators like
property, existed well before the decorator syntax was added.  We had a lot of
experience writing post-definition "decorators", which taught us that the
behavior was useful but the syntax was painful.  And adding the syntax made a
huge improvement in readability.

Cheers,
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170214/7187e844/attachment.sig>


More information about the Python-ideas mailing list