On Mon, 30 Nov 2020 at 23:26, David Mertz <me...@gnosis.cx> wrote:
> Somehow "dire" doesn't strike me as the right word.... Maybe you were looking 
> for "conceivably useful in niche cases."?

Well, I think const can be useful for:
* multiprocessing. Now, for example, dict is passed between processes
using MappingProxyType, which is slow.
* avoid side effects. I expect that my object will not change and I
want to be sure I'll not change it by mistake. Mistake that I made a
lot of times.
* contract. A function marks a parameter as const will guarantee that
the object will not be changed. It's something complementar to
annotations.
* possible future speed improvements. For example, if an iterable is
const, you can skip a lot of checks about mutability on iteration and
make it more fast.
_______________________________________________
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/GVYJJCPRBYTTXFJ7GYTUMSDVYUWJZUJU/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to