[issue19660] decorator syntax: allow testlist instead of just dotted_name

2020-02-20 Thread Brandt Bucher
Change by Brandt Bucher : -- nosy: +brandtbucher resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> PEP 614: Relaxing Grammar Restrictions On Decorators ___ Python tracker

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2019-01-21 Thread Jeroen Demeyer
Jeroen Demeyer added the comment: There is again some discussion about this at https://discuss.python.org/t/why-are-some-expressions-syntax-errors/420 -- ___ Python tracker

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2018-07-09 Thread Jeroen Demeyer
Jeroen Demeyer added the comment: Real world example where this actually came up: https://github.com/jupyter-widgets/ipywidgets/issues/430#issuecomment-247016263 -- nosy: +jdemeyer ___ Python tracker

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2016-07-31 Thread Guido van Rossum
Guido van Rossum added the comment: OK, maybe someone else wants to provide a real-world example. Otherwise I am really going to close this (again). -- ___ Python tracker

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2016-07-31 Thread Emanuel Barry
Emanuel Barry added the comment: We want to be able to access the instance attributes (as is done e.g. here: https://github.com/lykoss/lykos/blob/1852bf2c442d707ba0cbc16e8c9e012bcbc4fcc5/src/wolfgame.py#L9761 ). I realize we can set the attributes directly on the functions, but we've decided

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2016-07-31 Thread Guido van Rossum
Guido van Rossum added the comment: OK, so if you wanted to be able to call myrole(...) instead of myrole.caller, why doesn't cmd.__call__ return self.caller rather than just self? -- ___ Python tracker

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2016-07-31 Thread Emanuel Barry
Emanuel Barry added the comment: Sure, here goes; this is an IRC game bot which I contribute to. Apologies for the long links, it's the only way to make sure this consistently points to the same place regardless of future commits. The 'cmd' decorator we use is defined at

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2016-07-31 Thread Guido van Rossum
Guido van Rossum added the comment: Could you link to an example decorator definition and its call site(s) that would benefit? I'm lacking the imagination to understand what a "dynamic decorator" might be. @spam().eggs() is not enough to help me understand -- I understand quite well what syntax

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2016-07-31 Thread Emanuel Barry
Emanuel Barry added the comment: TL;DR - Use case is dynamic decorators. Not all of the syntax would make sense, see below. The main benefit of this feature would be for dynamic decorators (as was evidenced from others in this issue). In a project I contribute to, we use dynamic decorators

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2016-07-31 Thread Guido van Rossum
Guido van Rossum added the comment: Nobody has posted a real use case. All the examples are toys. What are the real use cases that are blocked by this? Readability counts! -- ___ Python tracker

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2016-07-31 Thread Berker Peksag
Changes by Berker Peksag : -- nosy: +berker.peksag ___ Python tracker ___ ___

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2015-03-31 Thread Ximin Luo
Ximin Luo added the comment: Yes, please get rid of this restriction. It's trivial to get around - you don't even need to define your own pass-through, one already exists in the standard library: @(lambda: [lambda x: x][0])() File stdin, line 1 @(lambda: [lambda x: x][0])() ^

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2013-11-22 Thread Eric V. Smith
Eric V. Smith added the comment: While I think that the dotted_name restriction should be relaxed and it should instead be a style guide issue, I have to agree with Benjamin here: the difference in grammar complexity is zero and shouldn't drive the decision. --

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2013-11-21 Thread Benjamin Peterson
Benjamin Peterson added the comment: I think the complexity delta in the grammar is exactly 0. -- nosy: +benjamin.peterson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19660 ___

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2013-11-20 Thread Andy Dirnberger
Changes by Andy Dirnberger d...@dirnonline.com: -- nosy: +dirn ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19660 ___ ___ Python-bugs-list

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2013-11-20 Thread Peyton Sherwood
Changes by Peyton Sherwood peyt...@gmail.com: -- nosy: +peyton ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19660 ___ ___ Python-bugs-list

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2013-11-20 Thread Éric Araujo
Éric Araujo added the comment: Thanks for this! Tests should exercise the now-valid syntaxes, which also need documentation. -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19660

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2013-11-20 Thread Éric Araujo
Éric Araujo added the comment: On second thought, as this patch allows one form that Guido doesn’t want (bar().foo()), maybe there should be a discussion on python-ideas. -- nosy: +nick ___ Python tracker rep...@bugs.python.org

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2013-11-20 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- nosy: +ncoghlan -nick ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19660 ___ ___ Python-bugs-list

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2013-11-20 Thread Nick Coghlan
Nick Coghlan added the comment: Nice! As a syntax change (albeit a minor one), I believe this will require a PEP for Python 3.5. I know Guido indicated he was OK with relaxing the current restrictions, but I don't remember exactly where he said it, or how far he was willing to relax them.

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2013-11-20 Thread Guido van Rossum
Guido van Rossum added the comment: I don't feel very strongly, but I do think that most of the things the new syntax allows are not improvements -- they make the decorator harder to read. It was intentional to force you to compute a variable before you can use it as a decorator, e.g.

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2013-11-20 Thread Eric Snow
Eric Snow added the comment: they make the decorator harder to read. I agree. -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19660 ___

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2013-11-20 Thread James Powell
James Powell added the comment: 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

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2013-11-20 Thread James Powell
Changes by James Powell ja...@dontusethiscode.com: Added file: http://bugs.python.org/file32745/decorator-syntax.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19660 ___

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2013-11-20 Thread Nick Coghlan
Nick Coghlan added the comment: Yes, a PEP for 3.5 on this will be valuable, whether it's accepted or not (although I personally favour moving these restrictions out of the compiler and into the PEP 8 style guide). If I recall the past python-ideas threads correctly, the main objections to the

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2013-11-19 Thread James Powell
New submission from James Powell: Decorator syntax currently allows only a dotted_name after the @. As far as I can tell, this was a gut-feeling decision made by Guido. [1] I spoke with Nick Coghlan at PyTexas about this, and he suggested that if someone did the work, there might be interest

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2013-11-19 Thread James Powell
Changes by James Powell ja...@dontusethiscode.com: -- keywords: +patch Added file: http://bugs.python.org/file32717/decorator-syntax.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19660

[issue19660] decorator syntax: allow testlist instead of just dotted_name

2013-11-19 Thread Eric V. Smith
Changes by Eric V. Smith e...@trueblade.com: -- nosy: +eric.smith ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19660 ___ ___ Python-bugs-list