Bug in % string formatting?

Fernando Pérez fperez528 at yahoo.com
Wed Dec 19 09:42:06 EST 2001


Janko Hauser wrote:

> Operator precedence :-), change it to
>>>> print format_string % (names['John'][:] + names['Jane'][:] )
> 

Argggh! As they say in numerical recipes: you should brush your teeth every 
night in front of the operator precedence rules for your language of choice.

It does surprise me though that % binds harder than +. I would naively think 
that by its nature, % would have fairly low precedence. Oh well, I'm sure 
there's a good reason for it being the way it is.

Thanks Janko!

Cheers,

f




More information about the Python-list mailing list