On Wed, May 26, 2021 at 5:26 PM Shreyan Avigyan
<pythonshreya...@gmail.com> wrote:
>
> Reply to Chris:
>
> There are two things I want to say about constants :-
> 1) Global-Local Constants - The ALL_CAPS convention variables should become 
> constant.
> 2) Class member constants - Constants should be used only for avoiding from 
> being overridden. It should not be used as "We have a class. Use constants.". 
> Sometimes if someone changes a critical value especially in Python a 
> dynamically typed language it can have bad effects. Suppose we have a Windows 
> and we go to registry editor and delete keys and set different values and 
> then Windows won't boot up the next time. That's why class member constants 
> is necessary.
>

I don't understand this mentality. Firstly, Windows *does* have a
registry editor. You can indeed break things. Windows won't stop you.
Secondly, CPython comes with the ctypes module that allows you to
*change the values of literals*. I'm not kidding. You can actually
make it so that the integer 42 actually behaves as if it's 28. Do we
really need to stop people from doing things because they're
dangerous?

There are many arguments in favour of constants, but this one strikes
me as particularly weak.

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/2RTCGQBLXXT4EIUW34TU35Y2JBI44OOU/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to