[Python-ideas] Parenthesized Compound With Statement

Guido van Rossum guido at python.org
Wed Jul 3 23:39:37 CEST 2013


On Wed, Jul 3, 2013 at 1:55 PM, Ron Adam <ron3200 at gmail.com> wrote:

>  On 07/03/2013 12:34 PM, Guido van Rossum wrote:
>
>> On Wed, Jul 3, 2013 at 9:56 AM, Ron Adam <ron3200 at gmail.com> wrote:
>>
>
>  Sometimes adding a backslash within a container can make a continued line
>>> between many single line items stand out better. (*)
>>>
>>> (* There have been "silent" bugs where a comma was omitted in cases where
>>> some lines are continued and some aren't.)
>>>
>>
>> I don't understand what you are referring to here, but I don't think
>> we should invoke backslashes to solve the problem of significant
>> trailing commas.
>>
>
> I'll see if I can find some real examples of this.
>
> It's a case where there is a long list, and every once in a while there is
> a long line that is implicitly continued.  So an occasional missing comma
> is what is supposed to be there.  Which makes seeing an actual missing
> comma is harder to do.
>
> When there is a long list with only a few continuations, I don't see how a
> few backslashes would be harmful, they would explicitly show those line are
> meant to be continued and are not missing a comma.
>
> I don't think this comes up that often, so it probably doesn't need any
> special treatment.


Maybe you're talking about this case:

instructions = [
    'foo',
    'bar',
    'very long line'            # comma intentionally missing
    ' which is continued here',
    'not so long line'            # comma accidentally missing
    'accidentally continued',
    'etc.',
]

I brought this up a few weeks or months ago, hoping to convince people that
implicit string concatenation is evil enough to ban. I didn't get very far.

But allowing backslashes here won't accomplish anything, because they are
redundant. (In fact I get really mad when people use backslashes for
continuation inside parens/brackets/braces. :-)

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130703/e4466293/attachment.html>


More information about the Python-ideas mailing list