Note that no other feature in typing is about the reference - everything is about the objects themselves. Final makes less sense as a general type. We can't enforce A[T]().foo() not to reassign a Final T.
Elazar
On 21 November 2017 at 10:47, Paul Moore <p.f.moore@gmail.com> wrote:-1. I don't see how this would improve any programs I've written or
seen. Tools like mypy or linters might benefit from a feature to track
constants and ensure they don't get changed_______________________________________________It is actually likely that something like this will appear in ``typing``:from typing import Final, Listx: Final = 42x = 1 # Fails type checklst: Final[List[int]] = []lst.append(5) # OKlst = [1, 2, 3] # Fails type check--Ivan
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/