Why does this (not) work?

Michael C. Neel neel at mediapulse.com
Tue Aug 19 19:16:27 EDT 2003


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?

To me:

>>>"%d" % 2 * 3
"222"

Is not what I expected nor wanted.  I could however be alone in that
opinion.  I'm selfish; as a programmer I don't really care about the
internals of the parser, I care about ease to code - that's what I like
about python, I don't spend time debugging syntax, but working on the
logic of the program.

It's probably not hard to guess I don't like ', '.join(list) either ;-)


thanks for all the replies though!
Mike





More information about the Python-list mailing list