How to support namedtuple in event state?
See original GitHub issueOne of my events has a namedtuple in its state. This event mutate the state of its parent entity as follow:
class SomethingAdded(BaseAggregateRoot.Event):
def mutate(self, obj):
obj.things = (*obj.things, self.my_namedtuple)
But when restoring the entity from the repository, the things
attribute has the following structure:
([...], [...])
clearly the namedtuple are replaced with list, so how to retrieve the entity while preserve it original state?
Issue Analytics
- State:
- Created 4 years ago
- Comments:16
Top Results From Across the Web
How to support namedtuple in event state? · Issue #191 ... - GitHub
One of my events has a namedtuple in its state. This event mutate the state of its parent entity as follow: class SomethingAdded(BaseAggregateRoot....
Read more >Write Pythonic and Clean Code With namedtuple - Real Python
With NamedTuple , you can create tuple subclasses that support type hints and attribute access through the dot notation. Since the resulting class...
Read more >What is the fastest (to access) struct-like object in Python?
One thing to bear in mind is that namedtuples are optimised for access as tuples. If you change your accessor to be a[2]...
Read more >Tuple types - C# reference - Microsoft Learn
Tuple types support equality operators == and != . For more information, see the Tuple equality section. Tuple types are value types; ...
Read more >++namedtuple - Python-style Named Tuples in C++20
01 const auto tuple = namedtuple {"price"_t = 42, ... where he uses template meta-programming techniques to support the C++ rule - "Don't...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for offering to help, @adnanmuttaleb. Perhaps if you haven’t already, you could join the Slack channel and we can chat about it there? If you don’t like Slack, we can continue to discuss things here, or elsewhere e.g. by email (mine is in the setup.py file).
Does this help? 6c79fa1259f8b0cba74ca5088275fa71036a3ef5