On Thu, Mar 15, 2018 at 12:40 AM, Søren Pilgård <fiskoma...@gmail.com> wrote: > Of course you can always make error, even in a single letter. > But I think there is a big difference between mixing up +-/* and ** > where the operator is in "focus" and the implicit concatenation where > there is no operator. > A common problem is that you have something like > foo(["a", > "b", > "c" > ]).bar() > but then you remember that there also needs to be a "d" so you just add > foo(["a", > "b", > "c" > "d" > ]).bar() > Causing an error, not with the "d" expression you are working on but > due to what you thought was the previous expression but python turns > it into one. > The , is seen as a delimiter by the programmer not as part of the > operation (or the lack of the ,).
You're creating a list. Put a comma at the end of every line; problem solved. Your edit would be from this: foo(["a", "b", "c", ]).bar() to this: foo(["a", "b", "c", "d", ]).bar() and there is no bug. In fact, EVERY time you lay out a list display vertically (or dict or set or any equivalent), ALWAYS put commas. That way, you can reorder the lines freely (you don't special-case the last one), you can append a line without changing the previous one (no noise in the diff), etc, etc, etc. ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/