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

Steven D'Aprano steve at pearwood.info
Wed Feb 15 06:32:48 EST 2017

On Tue, Feb 14, 2017 at 04:34:09PM -0500, Barry Warsaw wrote:
> 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.

Your memory of the discussion may be more accurate than mine, but the 
PEP does suggest that general unfamiliarity with the concept was still a 
large issue:



More information about the Python-ideas mailing list