> > On 9/6/05, Barry Warsaw <[EMAIL PROTECTED]> wrote:
> > > printf('$1 forgot to frobnicate the $2!\n', username, file.name,
> > > to=sys.stderr)
...
> For me, the problem with that proposal is not the precise format syntax,
> but the fact that formatting is tied to a specific function which _also_
> outputs stuff to screen.
So borrow a trick from Common Lisp and use a destination of None
to mean "return the formatted text as a string".
>>> x = printf("$2 $1", 123,321)
321 123
>>> print x
None
>>> x = printf("$2 $1", 123,321, to=None)
>>> print x
321 123
Or is that too cryptic?
--
g
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com