Message203555
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? |
|
Date |
User |
Action |
Args |
2013-11-21 01:36:23 | james | set | recipients:
+ james, gvanrossum, ncoghlan, eric.smith, eric.araujo, eric.snow, dirn, Guido.van.Rossum, peyton |
2013-11-21 01:36:22 | james | set | messageid: <1384997782.98.0.228351558707.issue19660@psf.upfronthosting.co.za> |
2013-11-21 01:36:22 | james | link | issue19660 messages |
2013-11-21 01:36:22 | james | create | |
|