Nick Coghlan <ncogh...@gmail.com> added the comment:

Declaring "I intend for instances of this class to be immutable" isn't a fuzzy 
concept - it's in the same vein as other type hints, like "I intend for this to 
be a string". The part that's fuzzy is how well Python actually enforces that 
declaration, and hence the degree to which you can actually rely on it at 
runtime.

In most cases, detecting and reporting *violations* of that intent would be in 
the realm of typecheckers rather than the language interpeter, but there'd be 
cases where the interpreter itself could make useful inferences from such a 
declaration (for example, by prohibiting conventional mutation operations, the 
way "frozen=True" does for data classes).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue24991>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to