This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Rosuav
Recipients Rosuav, docs@python
Date 2016-03-17.06:29:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1458196198.66.0.0478952577579.issue26576@psf.upfronthosting.co.za>
In-reply-to
Content
The official documentation declares an unambiguous equivalence which is not true in some corner cases:

    @deco
    def f(x): pass

is not quite the same as

    def f(x): pass
    f = deco(f)

as the name is never bound to the undecorated function. This is what makes @property and @prop.setter work; otherwise, the undecorated setter function would overwrite the property, and the decoration would fail. Attached patch loosens the wording slightly to "broadly equivalent"; this permits corner cases to vary from the equivalence, while still retaining its simplicity for the 99% of cases where it's correct. (Think of explaining "yield from iter" as "for x in iter: yield x" and you have a similar near-equivalence.)

Also, class decorators aren't required to return classes. Text removed saying that they do.
History
Date User Action Args
2016-03-17 06:29:58Rosuavsetrecipients: + Rosuav, docs@python
2016-03-17 06:29:58Rosuavsetmessageid: <1458196198.66.0.0478952577579.issue26576@psf.upfronthosting.co.za>
2016-03-17 06:29:57Rosuavlinkissue26576 messages
2016-03-17 06:29:57Rosuavcreate