Thomas Grainger: > This is already available with typing.Final and immutable types: > > from typing import Final > > ham: Final = 3 > ham = 4 # Error > > hams: Final[Sequence[str]] = ["ham", "spam"] > hams.append("meat") # Error
I'm not sure whether it's a reply to me or someone else. But anyways this is a convention. mypy will detect it. *But* I have a feeling that constants can have performance improvements though I'm not sure. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/2T4N5GCN6VWNZM5T7RXKSRDXSTSRVZBX/ Code of Conduct: http://python.org/psf/codeofconduct/