Crutcher Dunnavant wrote:
> Python currently supports 'S % X', where S is a strinng, and X is one of:
> * a sequence
> * a map
> * treated as (X,)
>
> But I have some questions about this for python 3000.
>
> 1. Shouldn't there be a format method, like S.format(), or S.fmt()?
Possible, but why? "%" works quite fine. "Abusing" the modulus operator
is okay in this context since the symbol gives a nonoverseeable clue to
what the construct is doing.
> 2. What about using __call__ instead of / in addition to __rmod__?
> * "time: %s"(time.ctime()) == "time: %s" % time.ctime()
> * "%(a)s %(b)s"(a=1, b=2) == "%(a)s %(b)s" % {'a'=1, 'b'=2}
Damn ugly. How would you explain to a newbie that you can _call_ a string?
And that _calling_ a string does a formatting operation?
For me, string formatting with "%" is fine as it is.
BTW, has anyone seen string.Template being used somewhere?
Georg
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com