[Python-Dev] Replacement for print in Python 3.0
Gareth McCaughan
gmccaughan at synaptics-uk.com
Tue Sep 6 17:53:49 CEST 2005
More information about the Python-Dev mailing list
Tue Sep 6 17:53:49 CEST 2005
- Previous message: [Python-Dev] Replacement for print in Python 3.0
- Next message: [Python-Dev] Replacement for print in Python 3.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> > On 9/6/05, Barry Warsaw <barry at python.org> 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
- Previous message: [Python-Dev] Replacement for print in Python 3.0
- Next message: [Python-Dev] Replacement for print in Python 3.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list