Advertisements

Erik Max Francis wrote:
> 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.)
>
Many thanks for pointing out that silly mistake.
But why isn't it legal?
By the way, the corrected version (with **) works just fine (with the
CVS version of Python from the weekend or today)

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!