Skip to content
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

[Feature Request] Frame Transaction #181

Open
MeGaNeKoS opened this issue Feb 19, 2024 · 0 comments
Open

[Feature Request] Frame Transaction #181

MeGaNeKoS opened this issue Feb 19, 2024 · 0 comments

Comments

@MeGaNeKoS
Copy link

Frame transaction is to ensure the mutable data got revert back during reloading frame or dropping it. This usefull when you have a function that mutate a list or dictionary and need to reload for some changes.

my_list = [1,2]

def addition(target_list):
    target_list.append(3)
    print("Reload here")

addition(my_list)

In this example, if you reload after appending item to the list, the value stil exist on the outer frame.

One approach that come to my mind is by dumping every time we enter a stack like using pickle. Then if we reload that frame, we can just reload the state of that frame. But this approach have some problem on circular variable.

class A:
   def __init__(self):
        self.b = None
class B:
   def __init__(self):
        self.a = None
a = A()
b = B()
a.b = b
b.a = a
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