[Python-3000] Please don't kill the % operator...

Steven Bethard steven.bethard at gmail.com
Thu Aug 16 20:47:59 CEST 2007


On 8/16/07, Christian Heimes <lists at cheimes.de> wrote:
> skip at pobox.com wrote:
> >     Alex> The PEP abstract says this proposal will replace the '%' operator,
>
> [...]
>
> I agree with Skip, too. The % printf operator is a very useful and
> powerful feature. I'm doing newbie support at my university and in
> #python. Newbies are often astonished how easy and powerful printf() is
> in Python. I like the % format operator, too. It's easy and fast to type
> for small jobs.
>
> I beg you to keep the feature. I agree that the new PEP 3101 style
> format is useful and required for more complex string formating. But
> please keep a simple one for simple jobs.

I honestly can't see the point of keeping this::

    >>> '%-10s bought %02i apples for %3.2f' % ('John', 8, 3.78)
    'John       bought 08 apples for 3.78'

alongside this::

    >>> '{0:-10} bought {1:02i} apples for {2:3.2f}'.format('John', 8, 3.78)
    'John       bought 08 apples for 3.78'

They're so similar I don't see why you think the latter is no longer
"easy and powerful".

STeVe
-- 
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
        --- Bucky Katt, Get Fuzzy


More information about the Python-3000 mailing list