New Python 3.0 string formatting - really necessary?
Aaron Brady
castironpi at gmail.com
Sat Dec 20 20:55:35 EST 2008
On Dec 20, 7:38 pm, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> Instead of just whinging, how about making a suggestion to fix it? Go on,
> sit down for an hour or ten and try to work out how a BINARY OPERATOR
> like % (that means it can only take TWO arguments) can deal with an
> arbitrary number of arguments, *without* having any special cases.
>
> Go on. Take your time. I'll be waiting.
Hi, not to take sides, but, there is a possibility.
This behavior is currently legal:
>>> "%i %%i" % 0 % 1
'0 1'
So, just extend it. (Unproduced.)
>>> "%i %i" % 0 % 1
'0 1'
>>> "%r %i" % (2, 3, 4) % 1
'(2, 3, 4) 1'
>>> "%r %i" % (2, 3, 4)
'(2, 3, 4) %i'
Which is quite clever and way ahead of its (posessive) time.
More information about the Python-list
mailing list