Bug in % string formatting?

Michael Hudson mwh at python.net
Fri Dec 21 12:34:06 CET 2001


Erik Max Francis <max at alcyone.com> writes:

> Fernando Pérez wrote:
> 
> > 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.
> 
> The reason is because % is also the modulo division operator.

Which is in turn a reason for not overloading operators too much.
Anyone ever done this:

cout << var ? "true" : "false";

in C++?  It was *years* before I realised why that didn't work...

Cheers,
M.



More information about the Python-list mailing list