[Python-ideas] Descouraging the implicit string concatenation
Guido van Rossum
gvanrossum at gmail.com
Wed Mar 14 11:03:02 EDT 2018
I use the feature regularly for long error messages, and when combined with
.format() or % it's not so easy to replace it with a + (it would require
adding parentheses).
So I am against formally discouraging it or adding something to PEP 8.
However linters could warn about lists of comma-separated strings with a
missing comma.
On Wed, Mar 14, 2018, 07:54 Oleg Broytman <phd at phdru.name> wrote:
> On Thu, Mar 15, 2018 at 01:18:06AM +1100, Steven D'Aprano <
> steve at pearwood.info> wrote:
> > On Wed, Mar 14, 2018 at 02:31:58PM +0100, Oleg Broytman wrote:
> > > Once I stumbled over a bug caused by this in legacy code in
> > > production. Fixing it was quite painful!
> >
> > Did you mean that *finding* the bug was painful? Fixing it should be
> > trivially easy: add a comma.
>
> The most painful was that the bug destroyed important information
> that was hard to fix later (enterprise code in production, the code is
> certificated and hard to replace).
>
> The second pain was to understand what was going on. When a program
> report "The OID in the certificate doesn't belong to the proper root
> OID" it's simpler to decide that the certificate is wrong, not that the
> list of root OIDs to check is wrong.
>
> The third pain was to find the bug. It's hard to spot a problem in
> the list
>
> oids = [
> "1.2.6.254.14."
> "19.9.91.281",
> "1.2.6.263.12."
> "481.7.9.6.3.87"
> "1.2.7.4.214.7."
> "9.1.52.12",
> ]
>
> There were about 50 OIDs like these, and the missing comma was in the
> middle of the list.
>
> > --
> > Steve
>
> Oleg.
> --
> Oleg Broytman http://phdru.name/ phd at phdru.name
> Programmers don't die, they just GOSUB without RETURN.
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180314/400422b3/attachment.html>
More information about the Python-ideas
mailing list