[Python-ideas] Re: Extending @ syntax to allow expressions

2019-10-22 Thread Serhiy Storchaka
22.10.19 06:41, Andrew Barnert via Python-ideas пише: 2: I'm not sure what this would to to uses of "@" as an operator, as has been suggested various times for various laudable reasons; remember that an @decorator or other function definition is just another statement, and arbitrary

[Python-ideas] Re: Extending @ syntax to allow expressions

2019-10-21 Thread Cameron Simpson
On 21Oct2019 20:41, Andrew Barnert wrote: On Oct 21, 2019, at 19:53, Cameron Simpson wrote: On 21Oct2019 17:18, Yonatan Zunger wrote: I came across a case which *might* be a use case for a syntax extension, but I'm not sure. Wanted to get feedback from the group. *The extension: *Extend

[Python-ideas] Re: Extending @ syntax to allow expressions

2019-10-21 Thread Steve Jorgensen
Steve Jorgensen wrote: > had not thought of that. That actually does work. :) > I would say that means there is no need for a new feature, but would it make > sense for > this idiom to be documented in a PEP or some other easily discoverable place? Sorry. I forgot to quote for context.

[Python-ideas] Re: Extending @ syntax to allow expressions

2019-10-21 Thread Steve Jorgensen
had not thought of that. That actually does work. :) I would say that means there is no need for a new feature, but would it make sense for this idiom to be documented in a PEP or some other easily discoverable place? ___ Python-ideas mailing list --

[Python-ideas] Re: Extending @ syntax to allow expressions

2019-10-21 Thread Cameron Simpson
On 21Oct2019 17:18, Yonatan Zunger wrote: I came across a case which *might* be a use case for a syntax extension, but I'm not sure. Wanted to get feedback from the group. *The extension: *Extend the decorator syntax from decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE

[Python-ideas] Re: Extending @ syntax to allow expressions

2019-10-21 Thread Jonathan Goble
On Mon, Oct 21, 2019 at 8:21 PM Yonatan Zunger wrote: > > Hey everyone, > > I came across a case which might be a use case for a syntax extension, but > I'm not sure. Wanted to get feedback from the group. [...] > @CronJob('job-name', params...).override('dev', more-params...) > def

[Python-ideas] Re: Extending @ syntax to allow expressions

2019-10-21 Thread Random832
On Mon, Oct 21, 2019, at 22:30, Random832 wrote: > On Mon, Oct 21, 2019, at 22:00, Steve Jorgensen wrote: > > I think some idea like this might be worth proposing. the first idea > > that comes to my mind is to allow the name of a decorator to be an > > fstring using `@'...'` or `@"..."` syntax.

[Python-ideas] Re: Extending @ syntax to allow expressions

2019-10-21 Thread Random832
On Mon, Oct 21, 2019, at 22:00, Steve Jorgensen wrote: > I think some idea like this might be worth proposing. the first idea > that comes to my mind is to allow the name of a decorator to be an > fstring using `@'...'` or `@"..."` syntax. > > If, for example, you have `method_type = 'class'`,

[Python-ideas] Re: Extending @ syntax to allow expressions

2019-10-21 Thread Steve Jorgensen
I think some idea like this might be worth proposing. the first idea that comes to my mind is to allow the name of a decorator to be an fstring using `@'...'` or `@"..."` syntax. If, for example, you have `method_type = 'class'`, then you could decorate a method using `@'{method_type}method'`.