New Python 3.0 string formatting - really necessary?

Carl Banks pavlovevidence at gmail.com
Fri Dec 19 21:50:49 CET 2008


On Dec 19, 12:44 pm, r <rt8... at gmail.com> wrote:
> ~Michael,
> What’s next down this road of self destruction? Hey guys, forget about
> about empty parenthesis on a function/method call,  we should not have
> to waste are time typing them… Wait forget about them all together and
> we will just write Ruby code…
>
> Def function arg arg arg arg arg arg
>
> “Yea, that looks good“.insert(sarcasm)
> Things like forcing empty tuple on function/method calls are what make
> python so great. Python dumped the C bracket plague,  but enforces
> parenthesis even for a no argument function. But hell, why shouldn’t
> we have 50 ways to the same thing in Python like Ruby.
>
> PS. Don’t discredit Walter just because he is not on the dev team,
> that don’t mean squat!
>
> ~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,

No, you just think it's easiest because that's the way you learned it.

I'm kind of ambivalent about the change (it does have a couple minor
drawbacks), but I don't see any way that the new method isn't easier
to learn than the old--especially if you want to do more advanced
formatting--unless you already knew the old method.

I really don't like that they made format a string method, though, I
would have hoped for a built-in, and why didn't they abbreviate this
one?  If any function or method would have had a case for an
abbreviated name, this was it.  But just about anything is better than
that % operator and its multi-level confusion involving tuple syntax,
operator precedence, and special-casing of tuples and dicts.


> and this will just ease the
> transition to C programming for this student. Lets not forget how
> important C is!

C programmers who learn Python have to learn all kinds of new things,
a new string formating method would be a minor one.  As for everyone
else, they'll probably have an easier time of it.


Carl Banks



More information about the Python-list mailing list