Of all the odd quirks of python, this is the only thing that has bitten be
in the butt.
And several, several times.
List comprehensions have similar limitations as python lambdas, however, so
I guess the only way to execute several expressions on the item in the list
would be to pass the item to
On Fri, 11 Feb 2005, Matt Dimmic wrote:
> In Python, one bug that often bites me is this:
>
> (example A)
> aList = [1,2,3]
> for i in aList:
> i += 1
> print aList
> --> [1,2,3]
>
> This goes against my intuition, which is that aList == [2,3,4], probably
> because so much in Python is passe
In Python, one bug that often bites me is this:
(example A)
aList = [1,2,3]
for i in aList:
i += 1
print aList
--> [1,2,3]
This goes against my intuition, which is that aList == [2,3,4], probably
because so much in Python is passed by reference and not by value. Of
course I can always use ran