list comprehension question
Erik Max Francis
max at alcyone.com
Sun Aug 11 22:09:40 CEST 2002
brobbins333 at shaw.ca wrote:
> Why doesn't this work?
> list = [range(2, 12)]
> [(x ** 2) + x + 2 for x in list]
> error: unsupported operand type for **
Because you mean list = range(2, 12).
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/ \ There is nothing so subject to the inconstancy of fortune as war.
\__/ Miguel de Cervantes
Church / http://www.alcyone.com/pyos/church/
A lambda calculus explorer in Python.
More information about the Python-list