Closed georgeto closed 1 year ago
Hi @georgeto, thank you for contributing! 😄
And here I thought I was being clever by making use of mixin classes and fields instead of initializing these attributes in an __init__()
method... This is indeed an oversight, and not a deliberate design decision... In fact: this is a regression, as this wasn't a problem in version 0.1.1!
Anyhow, thank you for spotting and reporting this (and providing me with resources on possible solutions)! I will implement and release a fix soon with version 0.2.1 (along with your PR #10).
Also: this is example # 9000 in the case for adding a test suite to the project. I have just opened a new issue (#12) for this. Feel free to add to the discussion there if you have additional thoughts and opinions.
This has been fixed with the 0.2.1 release!
Some classes have fields with mutable value (e.g. lists), which are assigned a default value (e.g. empty list). If you have several instances of such a class, they each share the default values.
See the following example for illustration:
I assume this was an oversight and not a deliberate design decision. For a detailed explanation and possible solutions, see this section in the Python documentation.