On Sun, Jun 21, 2009 at 1:36 PM, Jerry Chen<j...@3rdengine.com> wrote:
> QUICK EXAMPLES
>
>    >>> "{} {} {}" @ (1, 2, 3)
>    '1 2 3'
>
>    >>> "foo {qux} baz" @ {"qux": "bar"}
>    'foo bar baz'
>
> One of the main complaints of a binary operator in PEP 3101 was the
> inability to mix named and unnamed arguments:
>
>    The current practice is to use either a dictionary or a tuple as
>    the second argument, but as many people have commented ... this
>    lacks flexibility.

The other reason an operator was a pain is the order of operations:

>>> '{0}'.format(1 + 2)
'3'
>>> '%s' % 1 + 2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: cannot concatenate 'str' and 'int' objects

In general, I don't see any gain in introducing an operator for string
formatting. What's the point? Maybe you save a few characters of
typing, but it sure is easier to Google for "Python string format"
than for "Python @".

A big -1 from me.

Steve
-- 
Where did you get the preposterous hypothesis?
Did Steve tell you that?
        --- The Hiphopopotamus
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to