Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread haypo s
2015-09-05 10:44 GMT+02:00 haypo s : > PEP 498 allows to write >'abc' f'string'< which is replaced with >>'abc' 'string'.__format__()< whereas str+str is a bad practice. Oops, you should read which is replaced with >'abc' + 'string'.__format__()< with a '+' between the

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread Gustavo Carneiro
On 5 September 2015 at 09:44, haypo s wrote: > 2015-09-05 5:01 GMT+02:00 Guido van Rossum : > > And I'm ready to accept it. I'll wait until Tuesday night (Monday's a > > holiday in the US) in case anything unforeseen comes up, but this is > really > >

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread haypo s
2015-09-05 5:01 GMT+02:00 Guido van Rossum : > And I'm ready to accept it. I'll wait until Tuesday night (Monday's a > holiday in the US) in case anything unforeseen comes up, but this is really > the Last Call for this PEP. Would it be possible to specify a subset of the Python

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread Chris Angelico
On Sat, Sep 5, 2015 at 7:10 PM, haypo s wrote: > 2015-09-05 5:01 GMT+02:00 Guido van Rossum : >> And I'm ready to accept it. I'll wait until Tuesday night (Monday's a >> holiday in the US) in case anything unforeseen comes up, but this is really >> the

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread Chris Angelico
On Sat, Sep 5, 2015 at 8:57 PM, Chris Angelico wrote: >> IMHO the main advantage of allowing expressions inside f-string is >> that it adds something really new compared to the current str.format() >> method. Without it, f-string are less interesting. > > I agree with your

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread haypo s
2015-09-05 5:01 GMT+02:00 Guido van Rossum : > And I'm ready to accept it. I'll wait until Tuesday night (Monday's a > holiday in the US) in case anything unforeseen comes up, but this is really > the Last Call for this PEP. String concatenation is inefficient in Python because

Re: [Python-Dev] PEP 501 Shell Command Examples

2015-09-05 Thread Nick Coghlan
On 5 September 2015 at 12:36, Nikolaus Rath wrote: > Hi Nick, > > You are giving > > runcommand(sh(i"cat {filename}")) > > as an example that avoids injection attacks. While this is true, I think > this is still a terrible anti-pattern[1] that should not be entombed in > a

Re: [Python-Dev] Critique of PEP 502 (String Interpolation Redux)

2015-09-05 Thread Mike Miller
On 09/04/2015 08:15 PM, Guido van Rossum wrote: The text of the PEP has too much on motivation and rationale: maybe that would be suitable for an informative PEP. The proposal itself is under-specified. But the real weakness cannot be fixed by improving the text: it is in the key… I'm

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread Nathaniel Smith
On Sep 5, 2015 11:32 AM, "Eric V. Smith" wrote: > > > Actually, my current implementation doesn't use the lexer, although I > > suppose it could. I'm currently manually scanning the string, keeping > > track of strings and parens. To find the end of an expression, it looks > >

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread Victor Stinner
> If you really want to allow *any* Python inside a f-string, can you >> please at least explain in the PEP why you consider that it's a good >> thing? >> > > Sigh. We've gone over this on python-ideas. Your objection is not new. > I'm sure that later others will have exactly the same question

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread Brett Cannon
On Sat, 5 Sep 2015 at 09:19 Guido van Rossum wrote: > On Sat, Sep 5, 2015 at 2:10 AM, haypo s wrote: > >> 2015-09-05 5:01 GMT+02:00 Guido van Rossum : >> > And I'm ready to accept it. I'll wait until Tuesday night (Monday's a >> >

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread Nathaniel Smith
On Sep 5, 2015 9:20 AM, "Guido van Rossum" wrote: > > The processing of f-strings described by the PEP uses several phases: > > - find the end of the string (the final quote[s]) using the same algorithm used for all string literals > - expand \ escapes (e.g. \u) It might be

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread Terry Reedy
On 9/5/2015 12:18 PM, Guido van Rossum wrote: On Sat, Sep 5, 2015 at 2:10 AM, haypo s > wrote: We already went over this. You might as well argue that __import__ or lambda should not be used as arguments to print(). It's an

Re: [Python-Dev] PEP 501 Shell Command Examples

2015-09-05 Thread Nikolaus Rath
On Sep 05 2015, Nick Coghlan wrote: > On 5 September 2015 at 12:36, Nikolaus Rath wrote: >> Hi Nick, >> >> You are giving >> >> runcommand(sh(i"cat {filename}")) >> >> as an example that avoids injection attacks. While this is true, I think >> this is

Re: [Python-Dev] What's New editing

2015-09-05 Thread Guido van Rossum
Awesome! We need more people with those skills! --Guido (on mobile) On Sep 5, 2015 11:07 AM, "Yury Selivanov" wrote: > On 2015-09-05 1:27 PM, David Mertz wrote: > >> I have to apologize profusely here. Just after I offered to do this (and >> work even said it was OK in

[Python-Dev] PEPs and PEP 8 changes

2015-09-05 Thread Jim J. Jewett
PEP 498 is only the latest PEP where part of the concern is fear that it may encourage certain types of bad code. Would it be reasonable to ask PEPs to start including a section on any recommended changes to PEP8? (e.g., "If an embedded expression doesn't fit on a single line, factor it out to a

Re: [Python-Dev] What's New editing

2015-09-05 Thread David Mertz
I have to apologize profusely here. Just after I offered to do this (and work even said it was OK in principle to do it on work time), my work load went through the roof. And now it's really already later than most of it should have been done. I'd still very much like to work on this, but I

Re: [Python-Dev] What's New editing

2015-09-05 Thread Yury Selivanov
On 2015-09-05 1:27 PM, David Mertz wrote: I have to apologize profusely here. Just after I offered to do this (and work even said it was OK in principle to do it on work time), my work load went through the roof. And now it's really already later than most of it should have been done. I'd

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread Eric V. Smith
> Actually, my current implementation doesn't use the lexer, although I > suppose it could. I'm currently manually scanning the string, keeping > track of strings and parens. To find the end of an expression, it looks > for a '!', ':', or non-doubled '}', not inside of a string or (), [], or > {}.

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread Eric V. Smith
On 9/5/2015 3:23 PM, Nathaniel Smith wrote: > On Sep 5, 2015 11:32 AM, "Eric V. Smith" > wrote: >> Ignore the part about non-doubled '}'. The actual description is: >> >> To find the end of an expression, it looks for a '!', ':', or '}', not >>

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread Eric V. Smith
On 9/5/2015 1:28 PM, Nathaniel Smith wrote: > On Sep 5, 2015 9:20 AM, "Guido van Rossum" > wrote: >> >> The processing of f-strings described by the PEP uses several phases: >> >> - find the end of the string (the final quote[s]) using the same >

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread Eric V. Smith
On 9/5/2015 1:14 PM, Gustavo Carneiro wrote: > Why not allow string concatenation without plus sign only if/when the > implementation becomes optimised to allow compile time concatenation? > This makes it crystal clear whether the concatenation is compile time or > runtime. If we allow it now,

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread Eric V. Smith
On 9/5/2015 12:18 PM, Guido van Rossum wrote: > On Sat, Sep 5, 2015 at 2:10 AM, haypo s > wrote: > > (is it possible to indent and comment code inside a f-string?) > > > Now that's an interesting question. I think the answer must

Re: [Python-Dev] What's New editing

2015-09-05 Thread Yury Selivanov
On 2015-09-05 2:23 PM, Guido van Rossum wrote: Awesome! We need more people with those skills! --Guido (on mobile) Great, we'll start today! Thanks, Yury ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] Critique of PEP 501 (General purpose string interpolation)

2015-09-05 Thread Guido van Rossum
On Sat, Sep 5, 2015 at 5:11 AM, Nick Coghlan wrote: > On 5 September 2015 at 13:04, Guido van Rossum wrote: > > I think it's too much effort for too little gain. > > > > The motivation feels very weak; surely writing > > > > os.system("echo " +

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread Guido van Rossum
On Sat, Sep 5, 2015 at 2:10 AM, haypo s wrote: > 2015-09-05 5:01 GMT+02:00 Guido van Rossum : > > And I'm ready to accept it. I'll wait until Tuesday night (Monday's a > > holiday in the US) in case anything unforeseen comes up, but this is > really >

Re: [Python-Dev] Critique of PEP 501 (General purpose string interpolation)

2015-09-05 Thread Nick Coghlan
On 5 September 2015 at 13:04, Guido van Rossum wrote: > I think it's too much effort for too little gain. > > The motivation feels very weak; surely writing > > os.system("echo " + message_from_user) > > is just as easy (as is the %s spelling), so the security issue can hardly

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread Guido van Rossum
On Sat, Sep 5, 2015 at 1:44 AM, haypo s wrote: > 2015-09-05 5:01 GMT+02:00 Guido van Rossum : > > And I'm ready to accept it. I'll wait until Tuesday night (Monday's a > > holiday in the US) in case anything unforeseen comes up, but this is > really >

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread Barry Warsaw
On Sep 04, 2015, at 08:01 PM, Guido van Rossum wrote: >And I'm ready to accept it. As I've mentioned to Eric, I think it's a great PEP, so congratulations on getting one through The Gauntlet. I know that in my own code, I'm looking forward to using it in however many years it takes for 3.6 to

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread Eric V. Smith
On 9/5/2015 7:12 PM, Nathaniel Smith wrote: > On Sat, Sep 5, 2015 at 1:00 PM, Eric V. Smith wrote: >> On 9/5/2015 3:23 PM, Nathaniel Smith wrote: >>> On Sep 5, 2015 11:32 AM, "Eric V. Smith" >> > wrote: Ignore the part about

Re: [Python-Dev] PEPs and PEP 8 changes

2015-09-05 Thread Brett Cannon
On Sat, 5 Sep 2015 at 12:58 Jim J. Jewett wrote: > PEP 498 is only the latest PEP where part of the concern is fear that > it may encourage certain types of bad code. > > Would it be reasonable to ask PEPs to start including a section on any > recommended changes to PEP8?

Re: [Python-Dev] PEPs and PEP 8 changes

2015-09-05 Thread Barry Warsaw
On Sep 05, 2015, at 03:57 PM, Jim J. Jewett wrote: >Would it be reasonable to ask PEPs to start including a section on any >recommended changes to PEP8? (e.g., "If an embedded expression >doesn't fit on a single line, factor it out to a named variable.") Yes, I think it's reasonable to

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread Guido van Rossum
On Sat, Sep 5, 2015 at 2:22 PM, Victor Stinner wrote: > > If you really want to allow *any* Python inside a f-string, can you >>> please at least explain in the PEP why you consider that it's a good >>> thing? >>> >> >> Sigh. We've gone over this on python-ideas. Your

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread Nathaniel Smith
On Sat, Sep 5, 2015 at 1:00 PM, Eric V. Smith wrote: > On 9/5/2015 3:23 PM, Nathaniel Smith wrote: >> On Sep 5, 2015 11:32 AM, "Eric V. Smith" > > wrote: >>> Ignore the part about non-doubled '}'. The actual description is: >>>

Re: [Python-Dev] PEP 498: Literal String Interpolation is ready for pronouncement

2015-09-05 Thread Gustavo Carneiro
Why not allow string concatenation without plus sign only if/when the implementation becomes optimised to allow compile time concatenation? This makes it crystal clear whether the concatenation is compile time or runtime. If we allow it now, it's hard to tell without looking at the CPython source

Re: [Python-Dev] What's New editing

2015-09-05 Thread Ryan Gonzalez
On September 5, 2015 12:27:26 PM CDT, David Mertz wrote: >I have to apologize profusely here. Just after I offered to do this >(and >work even said it was OK in principle to do it on work time), my work >load >went through the roof. And now it's really already later than most