pout
pout copied to clipboard
Seen values for mutable structures
def foo():
d = {}
for i in range(5):
d[i] = i
yield d
pout.v(foo())
Would result in:
foo() = ... (5)
(
0: dict (1)
{
0: 0
},
1: <dict (2) at 0x103317c00>,
2: <dict (3) at 0x103317c00>,
3: <dict (4) at 0x103317c00>,
4: <dict (5) at 0x103317c00>
)
Notice how the dictionary count changes in indexes 1-4 but it doesn't display them because the same dictionary has been mutated but pout has already "seen" the dictionary so it sends it through Value.seen_value instead of generating the string value again.
I'm not completely sure how to fix this. I can save the count value and add a check to show regenerate the value if the count has changed, but that doesn't completely fix the problem.