Skip to content

Support += (__iadd__) on list properties #164

@dannyroberts

Description

@dannyroberts

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions