[issue36223] Execution sequence for print function
Karthikeyan Singaravelan
report at bugs.python.org
Thu Mar 7 05:45:10 EST 2019
Karthikeyan Singaravelan <tir.karthi at gmail.com> added the comment:
Agreed with @remi.lapeyre. There is no delayed evaluation in Python and this is not only related to print but it's the general evaluation model in Python. Another example as below since foo(1) is used as an argument it's evaluated first and then the return value is passed.
def bar(a, b):
print("bar ", a, b)
return (a, b)
def foo(b):
print("foo ", b)
return b
bar(foo(1), 2) # foo is first evaluated to pass 1 bar
$ python3 /tmp/foo.py
foo 1
bar 1 2
Closing this as not a bug.
----------
nosy: +xtreak
resolution: -> not a bug
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36223>
_______________________________________
More information about the Python-bugs-list
mailing list