#237·PySnooper

No variable output from the last line

Author: webber26232Created May 18, 2023Updated May 19, 2023

Hi, I found that the variable, new or modified, in the last line will not be shown. Below is the same example with the print removed:

import pysnooper
import random

def foo():
    lst = []
    for i in range(10):
        lst.append(random.randrange(1, 1000))

    with pysnooper.snoop():
        lower = min(lst)
        upper = max(lst)
        mid = (lower + upper) / 2

foo()

which outputs something like:

New var:....... lst = [379, 800, 331, 57, 210, 524, 525, 837, 118, 810]
New var:....... i = 9
22:46:58.874665 line        10         lower = min(lst)
New var:....... lower = 57
22:46:58.876660 line        11         upper = max(lst)
New var:....... upper = 837
22:46:58.876660 line        12         mid = (lower + upper) / 2
Elapsed time: 00:00:00.003000

We can find that the variable mid was not printed. Please let me know if this is expected.