[Python-Dev] Status regarding Old vs. Advanced String Formating

INADA Naoki songofacandy at gmail.com
Sat Feb 25 11:44:35 CET 2012


I don't feel "similar to other language" is not enough reason for
builtins violates the Zen.

Violating the Zen by standard library like `getopt` for compatibility to
other language or API is good.
So, I prefer moving %-style format from builtin str to function in string
module in Python 4.

On Sat, Feb 25, 2012 at 7:20 PM, "Martin v. Löwis" <martin at v.loewis.de> wrote:
>> I find that strange, especially for an expert Python dev. I, a newbie,
>> find it far friendlier (and easier for a new programmer to grasp).
>> Maybe it's because I use it all the time, and you don't?
>
> That is most likely the case. You learn by practice. For that very
> reason, the claim "and easier for a new programmer to grasp" is
> difficult to prove. It was easier for *you*, since you started using
> it, and then kept using it. I don't recall any particular obstacles
> learning % formatting (even though I did for C, not for C++).
> Generalizing that it is *easier* is invalid: you just didn't try
> learning that instead first, and now you can't go back in a state
> where either are new to you.
>
> C++ is very similar here: they also introduced a new way of output
> (iostreams, and << overloading). I used that for a couple of years,
> primarily because people said that printf is "bad" and "not object-
> oriented". I then recognized that there is nothing wrong with printf
> per so, and would avoid std::cout in C++ these days, in favor of
> std::printf (yes, I know that it does have an issue with type safety).
>
> So I think we really should fight the impression that % formatting
> in Python is "bad", "deprecated", or "old-style". Having both
> may be considered a slight violation of the Zen, however, I would
> claim that neither formatting API are that obvious - AFAIR, the
> biggest hurdle in learning printf was to understand the notion
> of "placeholder", which I think is the reason why people are coming
> up with so many templating systems (templating isn't "obvious").
>
> Regards,
> Martin
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/songofacandy%40gmail.com



-- 
INADA Naoki  <songofacandy at gmail.com>


More information about the Python-Dev mailing list