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

Support += (__iadd__) on list properties #164

Open
dannyroberts opened this issue Mar 22, 2019 · 0 comments
Open

Support += (__iadd__) on list properties #164

dannyroberts opened this issue Mar 22, 2019 · 0 comments

Comments

@dannyroberts
Copy link
Member

dannyroberts commented Mar 22, 2019

currently

In [1]: from jsonobject import *

In [2]: class Foo(JsonObject):
   ...:     bar = ListProperty()
   ...:     

In [3]: foo = Foo()

In [4]: foo.bar = [1, 2, 3]

In [5]: foo.to_json()
Out[5]: {'bar': [1, 2, 3]}

In [6]: foo.bar += [4]

In [7]: foo.to_json()  # The change isn't reflected here
Out[7]: {'bar': [1, 2, 3]}

In [8]: foo.bar  # ...even though it is here
Out [8]: [1, 2, 3, 4]
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