[New-bugs-announce] [issue36223] Execution sequence for print function

Ketan Sharma report at bugs.python.org
Thu Mar 7 05:24:25 EST 2019


New submission from Ketan Sharma <iitkgp.ketan at gmail.com>:

>>> 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.

----------
messages: 337381
nosy: iitkgp.ketan at gmail.com
priority: normal
severity: normal
status: open
title: Execution sequence for print function
type: behavior

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36223>
_______________________________________


More information about the New-bugs-announce mailing list