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 james
Recipients Guido.van.Rossum, dirn, eric.araujo, eric.smith, eric.snow, gvanrossum, james, ncoghlan, peyton
Date 2013-11-21.01:36:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1384997782.98.0.228351558707.issue19660@psf.upfronthosting.co.za>
In-reply-to
Content
I see this as removing a restriction and a special-case from the
decorator syntax (noting, of course, that these were introduced
deliberately.)

In terms of whether the new forms are improvements, my preference is to
leave this up to the judgement of the programmer, moderated of course by
their prevailing coding guide.

I would argue that this change does not force any additional complexity
on the programmer (who is free to take or leave it) or on the
interpreter (- the straightforwardness of the patch corroborates this.)

I would also argue that there are certainly cases where, in the midst of
some large codebase, the dotted_name restriction may seem a bit arbitrary.

This is likely true for:

class Foo:
    def bar(self, func):
        return func

    @staticmethod
    def baz(func):
        return func
	
    @staticmethod
    def quux():
        def dec(func):
            return func
        return dec

# invalid
@Foo().bar
def f(): pass

# valid
@Foo.baz
def f(): pass

# valid
@Foo.quux()
def f(): pass

For completeness' sake, I have attached a patch with an additional unit
test and amended documentation.

Should we proceed with writing a PEP for Python 3.5?
History
Date User Action Args
2013-11-21 01:36:23jamessetrecipients: + james, gvanrossum, ncoghlan, eric.smith, eric.araujo, eric.snow, dirn, Guido.van.Rossum, peyton
2013-11-21 01:36:22jamessetmessageid: <1384997782.98.0.228351558707.issue19660@psf.upfronthosting.co.za>
2013-11-21 01:36:22jameslinkissue19660 messages
2013-11-21 01:36:22jamescreate