iterator expression - please explain
Erik Max Francis
max at alcyone.com
Mon May 24 04:02:03 EDT 2004
Helmut Jarausch wrote:
> myfun(x^2 for x in xrange(10))
...
> I expected the sequence 0,1,4,9,....
> What am I missing and what's going on here?
^ is the bitwise xor operator. You wanted **. (Although what you wrote
above isn't legal anyway.)
--
__ Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
/ \ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
\__/ War is the province of chance.
-- Karl von Clausewitz
More information about the Python-list
mailing list