All Questions
Tagged with immutability python
6 questions
6
votes
1
answer
889
views
Python function that deeply "freezes" an object
I implemented a function that gets an object and returns its immutable counterpart. If the object contains another mutable object at any level, it freezes it too.
Is my code is good and/or can it be ...
5
votes
1
answer
378
views
Trying Out DDD : How to enforce data integrity and immutability
I've been transitioning from type-safe programming languages like Dart and Java to Python, and I'm trying to enforce Domain-Driven Design (DDD) principles in a language that naturally leans towards ...
3
votes
1
answer
260
views
Implement a Python frozenmap
There are frozenset in Python, but no frozendict or frozenmap. I tried to implement it (Don'...
3
votes
1
answer
732
views
Subclassing `int` to make colors
In the ROOT framework (originally a C++ framework, but python bindings are also supplied), colors are objects (ROOT.TColor) identified with an integer index.
This ...
5
votes
2
answers
1k
views
Functions with mutable and non-mutable named tuples
I am making some functions within a function for learning which when passed information about a named tuple: it returns a reference to a class object from which we can construct instances of the ...
3
votes
1
answer
805
views
Creating Proxy classes for immutable objects
As a bit of a learning project, I decided to take the concept of proxying objects a bit further and extend it to creating proxy classes which create proxy'd objects. I originally found the idea of ...