Why does this (not) work?

Erik Max Francis max at alcyone.com
Tue Aug 19 20:16:32 EDT 2003


"Michael C. Neel" wrote:

> Maybe I should phrase the question a bit differently, more to the real
> issue (I guess, it's all academic from here), why is the % operator
> used
> both for string formatting and remainders?

It's got a lot of precedent behind it, so it's too late to change now. 
At some point, someone decided it made sense, so it was done.

> To me:
> 
> >>>"%d" % 2 * 3
> "222"
> 
> Is not what I expected nor wanted.  I could however be alone in that
> opinion.

The real question is:  How likely is this issue going to be a real
problem?  Why not just learn to use parentheses when you're doing
something tricky with the right argument to the string formatting
operator, and be done with it, problem solved?

-- 
   Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
 __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/  \ Human salvation lies in the hands of the creatively maladjusted.
\__/  Dr. Martin Luther King, Jr.




More information about the Python-list mailing list