All Questions
Tagged with python-attrs immutability
4
questions
0
votes
1
answer
42
views
Unexpected `FrozenInstanceError` in unit test when using a frozen exception
I have a unit test that I want to show failing as part of a bug report. It's important not only that the test fail with an error, but that the error message very clearly evidences the underlying bug. ...
1
vote
2
answers
482
views
Passing parameters to frozen super dataclass
I have a simple (frozen) dataclass inheritance as follows:
from attrs import frozen
@frozen
class Interval:
left: str
right: str
@frozen
class RealInterval(Interval):
def ...
0
votes
1
answer
192
views
frozen data class with non trivial constructor
I'm trying to define a frozen data class with a non-trivial constructor
That is, the constructor needs to "tweak" the input before it initializes the corresponding data member:
from attrs ...
0
votes
2
answers
433
views
How can I get a modified copy of a immutable object?
How can I get a modified copy of a immutable object?
I.e. how could some_magical_method look like in this snipped?
import attr
@attr.s(frozen=True, slots=True)
class Config:
param1: int = attr....