[Python-Dev] Replacement for print in Python 3.0 (original) (raw)
Paolino paolo_veronelli at libero.it
Sat Sep 3 13:31:26 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 ]
Martin Blais wrote:
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((xx 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((xx for x in range(10)), iter=1) Illegal in python2.4.(Wrongly ?) And makes the star solution half unuseful.
def f(*args,**kwargs): ... pass ... f(*(1,2,3),iter=True) File "", line 1 f(*(1,2,3),iter=True)
Leaving out what I just asserted in the previous thread :( I suppose you meant output((x*x for x in range(10)), iter=1)
f(1,[2,3],(_ for _ in (4,5)),iter=True)
Regards Paolino
- 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 ]