[Python-ideas] Implicit string literal concatenation considered harmful?
Cameron Simpson
cs at zip.com.au
Thu May 16 04:24:36 CEST 2013
On 14May2013 20:00, Jan Kaliszewski <zuo at chopin.edu.pl> wrote:
| 14.05.2013 19:24, Mark Dickinson wrote:
|
| >> raise errors.DataError(
| >> 'Inconsistent revenue item currency: '
| >> 'transaction=%r; transaction_position=%r' %
| >> (transaction, transaction_position))
| >
| >Agreed. I use the implicit concatenation a lot for exception
| >messages like the one above
|
| Me too.
|
| But what do you think about:
|
| raise errors.DataError(
| 'Inconsistent revenue item currency: '
| c'transaction=%r; transaction_position=%r' %
| (transaction, transaction_position))
|
| c'...' -- for explicit string (c)ontinuation or (c)oncatenation.
I'm -1 on it myself.
I'd expect c'' to act like b'' or u'' or r'': making a "string"-ish
thing in a special way. But c'' doesn't; the nearest analog is r''
but c'' goes _backwards_.
I much prefer:
+ 'foo'
over
c'foo'
The former already works and is perfectly clear about what it's
doing. The "c" does not do it any better and is easier to miss,
visually.
Cheers,
--
Cameron Simpson <cs at zip.com.au>
On the contrary of what you may think, your hacker is fully aware
of your company's dress code. He is fully aware of the fact that it
doesn't help him to do his job.
- Gregory Hosler <gregory.hosler at eno.ericsson.se>
More information about the Python-ideas
mailing list