[Python-ideas] Descouraging the implicit string concatenation
Steven D'Aprano
steve at pearwood.info
Wed Mar 14 18:20:42 EDT 2018
On Wed, Mar 14, 2018 at 01:47:53PM -0300, Facundo Batista wrote:
> 2018-03-14 11:30 GMT-03:00 Stephan Houben <stephanh42 at gmail.com>:
>
> > Op 14 mrt. 2018 15:23 schreef "Facundo Batista" <facundobatista at gmail.com>:
> >
> > I propose the discouragement of the idiom.
> >
> >
> >
> > What does that mean?
>
> That we say "hey, this works but please don't use it, because it tends
> to a error prone way of writing some code, instead do this".
It's not error prone. It works perfectly. The error you are complaining
about has absolutely nothing to do with the intentional use of implicit
string concatenation. The error you describe comes from accidentally
leaving out a comma.
Suppose I follow this advice. I spend a month going through all my code,
removing every example of implicit string concatenation and replace it
with some work-around like runtime string concatenation or calling
textwrap.dedent() on triple quoted strings. And I swear to never, ever
use implicit string concatenation again.
And the very next day, I accidently leave out a comma in a list of
strings.
How exactly does it help me to follow this advice? All it does is give
me a lot of extra work to do, by avoiding a useful and reliable
feature, without preventing the error you are concerned about.
--
Steve
More information about the Python-ideas
mailing list