[Python-3000] Reminder: Py3k PEPs due by April

Blake Winton bwinton at latte.ca
Wed Apr 11 20:34:15 CEST 2007

Phillip J. Eby wrote:
>>> * Eliminate implicit string concatenation:   "abc" "def"
>> Sure, I use it, but if it went away, I would type the plus sign.  Not
>> a problem.  And it would be one less thing for newcomers to learn, and
>> explicit is better, right?
> But there's another Python principle here, I think...  complexity of 
> computation should be represented by complexity of syntax.  We don't 
> generally like to use properties for expensive computation, or methods for 
> simple field access, for example.  Putting in a '+' sign makes the code 
> *feel* like there's more computation going on, even if the computation gets 
> optimized away.

Given that the set of things the compiler can optimize grows at a faster 
rate than the syntax changes to the language, I'm not sure that that's 
really a principle.  Yeah, sure, you don't want to hide, say, a 
reverse-dns-lookup-with-associated-timeout behind the creation of a 
socket (to take a horrible example from Java that's just finished biting 
me), but + isn't really a heavyweight operator, especially if you're 
thinking of (small-ish) integers, and if the compiler optimizes it into 
less than one instruction, then great.

I suppose I see the + case for strings, in particular, as being more 
similar to the + case for numbers than calling methods or properties...


More information about the Python-3000 mailing list