[Python-ideas] Re: Allow arbitrary expressions in decorator syntax

2020-09-19 Thread Paul Moore
On Sat, 19 Sep 2020 at 04:06, Paolo Lammens wrote: > > I also wanted to add: > > If > > @a, b, c > def func(): ... > > was prohibited (i.e. you must use parentheses) because [it looks like] it > doesn't make any sense, shouldn't be also the case that any expression with > spaces should b

[Python-ideas] Re: Allow arbitrary expressions in decorator syntax

2020-09-19 Thread Guido van Rossum
Please stop arguing. On Fri, Sep 18, 2020 at 20:07 Paolo Lammens wrote: > I also wanted to add: > > If > > @a, b, c > def func(): ... > > was prohibited (i.e. you must use parentheses) because [it looks like] it > doesn't make any sense, > No, It is because tulles aren’t callable. So it

[Python-ideas] Re: Allow arbitrary expressions in decorator syntax

2020-09-19 Thread Paolo Lammens
> Please stop arguing. As far as I'm concerned, we weren't. :) > No, It is because tulles aren’t callable. So it CANNOT have a meaning. True, I realized that only after I sent it. > I didn't really follow the discussions on the PEP that relaxed the > rules, but I'd say that the current (restri

[Python-ideas] Re: f-strings as assignment targets

2020-09-19 Thread Rob Cliffe via Python-ideas
Parsing can be ambiguous:     f"{x}:{y}" = "a:b:c" Does this set     x = "a"     y = "b:c" or     x = "a:b"     y = "c" Rob Cliffe On 17/09/2020 05:52, Dennis Sweeney wrote: TL;DR: I propose the following behavior: >>> s = "She turned me into a newt." >>> f"She turned me into a {anima

[Python-ideas] Re: f-strings as assignment targets

2020-09-19 Thread Wes Turner
Regex uses the ? symbol to indicate that something is a "non-greedy" match (to default to "shortest match") import re str_ = "a:b:c" assert re.match(r'(.*):(.*)', str_).groups() == ("a:b", "c") assert re.match(r'(.*?):(.*)', str_).groups() == ("a", "b:c") Typically, debugging parsing issues invol

[Python-ideas] Re: f-strings as assignment targets

2020-09-19 Thread Christopher Barker
On Sat, Sep 19, 2020 at 12:10 PM Wes Turner wrote: > Regex uses the ? symbol to indicate that something is a "non-greedy" match > (to default to "shortest match") > exactly -- Regex was designed to be a parsing language, format specifiers were not. I'm quite surprised by how little the parse pa

[Python-ideas] Re: f-strings as assignment targets

2020-09-19 Thread Ricky Teachey
+1 on adding something like parse to the language. -0 on the assignment feature... it just doesn't seem to be that beneficial to me. But once parse exists in the language a rational and limited conversation about the fstring assignment feature becomes much more possible. On Sat, Sep 19, 2020, 3:47

[Python-ideas] Re: f-strings as assignment targets

2020-09-19 Thread Greg Ewing
On 20/09/20 7:45 am, Christopher Barker wrote: In [4]: from parse import parse In [5]: parse("{x}{y}{z}", a_string) Out[5]: In [6]: parse("{x:d}{y:d}{z:d}", a_string) Out[6]: So that's interesting -- different level of "greadiness" for strings than integers Hmmm, that seems really unintuit

[Python-ideas] Re: f-strings as assignment targets

2020-09-19 Thread Christopher Barker
On Sat, Sep 19, 2020 at 4:46 PM Greg Ewing wrote: > On 20/09/20 7:45 am, Christopher Barker wrote: > > In [4]: from parse import parse > > In [5]: parse("{x}{y}{z}", a_string) > > Out[5]: > > > > In [6]: parse("{x:d}{y:d}{z:d}", a_string) > > Out[6]: > > > > So that's interesting -- different l