"Immutable", like C. Not rebound has another keyword, in Java for example (final). If we want to only avoid rebounding, I think const will be a bit confusing for C/C++ people.
(I wrote "immutable" because in C constness can be removed) On Tue, 1 Dec 2020 at 01:12, Chris Angelico <ros...@gmail.com> wrote: > > On Tue, Dec 1, 2020 at 10:25 AM Marco Sulla > <marco.sulla.pyt...@gmail.com> wrote: > > > > 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. > > Are you assuming that "const" means "will not be rebound" or "is > immutable"? Or both? > > ChrisA > _______________________________________________ > 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/YFDQCVIIJAXAUJ54C7C4D7L6WQFKJ3EI/ > Code of Conduct: http://python.org/psf/codeofconduct/ _______________________________________________ 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/ZCZOWSLNZSPQ6H46XDB6C76CX64ZKSON/ Code of Conduct: http://python.org/psf/codeofconduct/