Michael Foord wrote:
Jim Jewett wrote:
PEP: 30xz Title: Simplified Parsing Version: $Revision$ Last-Modified: $Date$ Author: Jim J. Jewett JimJJewett@gmail.com Status: Draft Type: Standards Track Content-Type: text/plain Created: 29-Apr-2007 Post-History: 29-Apr-2007
Python initially inherited its parsing from C. While this has been generally useful, there are some remnants which have been less useful for python, and should be eliminated. + Implicit String concatenation + Line continuation with "\" + 034 as an octal number (== decimal 28). Note that this is listed only for completeness; the decision to raise an Exception for leading zeros has already been made in the context of PEP XXX, about adding a binary literal.
Rationale for Removing Implicit String Concatenation
Implicit String concatentation can lead to confusing, or even silent, errors.  def f(arg1, arg2=None): pass f("abc" "def") # forgot the comma, no warning ... # silently becomes f("abcdef", None)
Implicit string concatenation is massively useful for creating long strings in a readable way though:
call_something("first part\n" "second line\n" "third line\n")
I find it an elegant way of building strings and would be sad to see it go. Adding trailing '+' signs is ugly.
Currently at least possible, though doubtless some people won't like the left-hand alignment, is
call_something("""\ first part second part third part """)
Alas if the proposal to remove the continuation backslash goes through this may not remain available to us.
I realise that the arrival of Py3 means all these are up for grabs, but don't think any of them are really warty enough to require removal.
I take the point that octal constants are counter-intuitive and wouldn't be too disappointed by their removal. I still think Icon had the right answer there in allowing an explicit decimal radix in constants, so 16 as a binary constant would be 10000r2, or 10r16. IIRC it still allowed 0x10 as well (though Tim may shoot me down there).