New Python 3.0 string formatting - really necessary?
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Fri Dec 19 16:10:12 EST 2008
On Fri, 19 Dec 2008 10:44:25 -0800, r wrote:
> ~Bearophile,
> Thanks for your civil approach to this conversation but I must disagree
> with you on the new string formatting syntax. You said the new syntax is
> suppost to be easier on the n00b , I say it pollutes a students mind.
> What is wrong with similarities to C formatting, I find nothing
> complicated about it.
>
> %s (means put a string here)
> %d (means put a integer here)
> %f (means put a float here)
>
> It does not get any simpler than that,
Well for those simple cases you could simply use '%s' for strings,
integers, and floating point objects in Python. But '{0}' isn't more
complicated. But you get the extra flexibility to decouple the order in
the string and the order of the objects to be formatted.
> and this will just ease the transition to C programming for this
> student. Lets not forget how important C is!
To a Python "n00b"? Not important at all. Beside the point that '%s' is
still possible -- someone who knows C but struggles with replacing '%s'
by '{0}' has far greater problems.
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list