iterator expression - please explain
Helmut Jarausch
jarausch at igpm.rwth-aachen.de
Mon May 24 03:59:49 EDT 2004
Hi,
with Python 2.4a0 (CVS 2004/05/24)
I get
def myfun(myarg):
for z in myarg:
print z
myfun(x^2 for x in xrange(10))
2
3
0
1
6
7
4
5
10
11
I expected the sequence 0,1,4,9,....
What am I missing and what's going on here?
Many thanks for a hint,
Helmut.
---
Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany
More information about the Python-list
mailing list