Closed rlisahuang closed 1 year ago
Addressing #43, showing arguments of a print call if the arguments are variable names.
print
For example,
a = 10 print(a)
shows a in a PB on the second line;
a
a = 10 b = 20 print(a,b)
shows a, b in a PB on the third line.
a, b
In the following example
a = 10 b = 20 c = 30 print(a, b, b+c)
User might expect to see all of a b and c in PB for the fourth line, but only a and b will be displayed since b+c is not an identifier.
b
c
b+c
Also, in the following example (which is test/rtv/print/print_func_3.py)
test/rtv/print/print_func_3.py
a = 10 def foo(): global a a = a + 1 return a # expects to see a=10 in PB for the line below, but now it is showing 11 print(a, foo())
User might expect to see a=10in PB for the print call, but they will see 11 due to the side effect of foo(), which does not match Python semantics.
a=10
11
foo()
Minor edits according to suggestions from @slerner to ensure that we only show print arg values in PB when the args are name expressions. Merging into leap.
leap
Addressing #43, showing arguments of a
print
call if the arguments are variable names.General Use Cases
For example,
shows
a
in a PB on the second line;shows
a, b
in a PB on the third line.Potential Issues
In the following example
User might expect to see all of
a
b
andc
in PB for the fourth line, but onlya
andb
will be displayed sinceb+c
is not an identifier.Also, in the following example (which is
test/rtv/print/print_func_3.py
)User might expect to see
a=10
in PB for theprint
call, but they will see11
due to the side effect offoo()
, which does not match Python semantics.