[Python-Dev] Replacement for print in Python 3.0
Martin Blais
martin.blais at gmail.com
Sat Sep 3 03:45:57 CEST 2005
More information about the Python-Dev mailing list
Sat Sep 3 03:45:57 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/2/05, Phillip J. Eby <pje at telecommunity.com> wrote: > At 11:02 AM 9/3/2005 +1000, Nick Coghlan wrote: > >Printing the items in a sequence also becomes straightforward: > > > >print " ".join(map(str, range(10))) => output(*range(10)) > > > >Playing well with generator expressions comes for free, too: > > > >print " ".join(str(x*x) for x in range(10)) > > => output(*(x*x for x in range(10))) > > An implementation issue: that generator expression will get expanded into a > tuple, so you shouldn't use that for outputting large sequences. Then how about:: output(*(x*x for x in range(10)), iter=1) Where all given iterable parameters are automatically iterated?
- 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