Message337381
>>> def pola(arr):
... for i, item in enumerate(arr):
... arr[i] = item*item
...
>>> a = [1,2,3,4]
>>> print(a,pola(a),a)
[1, 4, 9, 16] None [1, 4, 9, 16]
I would expect the print statement to execute and print the arguments sequentially from left to right. This could be an optimization trick inside the Python compiler, but still different that what would be expected. Thanks. |
|
Date |
User |
Action |
Args |
2019-03-07 10:24:25 | iitkgp.ketan@gmail.com | set | recipients:
+ iitkgp.ketan@gmail.com |
2019-03-07 10:24:25 | iitkgp.ketan@gmail.com | set | messageid: <1551954265.43.0.245266247678.issue36223@roundup.psfhosted.org> |
2019-03-07 10:24:25 | iitkgp.ketan@gmail.com | link | issue36223 messages |
2019-03-07 10:24:25 | iitkgp.ketan@gmail.com | create | |
|