Skip to content

Seen values for mutable structures #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Jaymon opened this issue Dec 4, 2024 · 0 comments
Open

Seen values for mutable structures #103

Jaymon opened this issue Dec 4, 2024 · 0 comments

Comments

@Jaymon
Copy link
Owner

Jaymon commented Dec 4, 2024

        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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant