You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Both dataclass's and simple constants defined using ALL_CAPS notation can be altered during the run of the model. We don't really want this to be possible if these are true constants (e.g. Boltzmann's constant).
Describe the solution you'd like
Data classes can be frozen by specifying @dataclass(frozen=True).
Simple constants can be annotated using typing.Final as follows:
This does not stop the constant from being altered, but altering the constant will cause mypy to raise an error. This should reduce the chance of altering constants incorrectly.
Describe alternatives you've considered
We might decide that this is a bit paranoid, but personally feel that it's better to be careful.
Additional context
Issue #209 basically pertains to the opposite problem, so the two issues are very much linked.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Both
dataclass
's and simple constants defined usingALL_CAPS
notation can be altered during the run of the model. We don't really want this to be possible if these are true constants (e.g. Boltzmann's constant).Describe the solution you'd like
Data classes can be frozen by specifying
@dataclass(frozen=True)
.Simple constants can be annotated using
typing.Final
as follows:This does not stop the constant from being altered, but altering the constant will cause
mypy
to raise an error. This should reduce the chance of altering constants incorrectly.Describe alternatives you've considered
We might decide that this is a bit paranoid, but personally feel that it's better to be careful.
Additional context
Issue #209 basically pertains to the opposite problem, so the two issues are very much linked.
The text was updated successfully, but these errors were encountered: