On Wed, May 26, 2021 at 07:25:09AM -0000, Shreyan Avigyan wrote:
2) Class member constants - Constants should be used only for avoiding from being overridden.
But you said that constants can be overriden and the name rebound. Is your proposal only to add a keyword "constant" that does absolutely nothing? If that is not your proposal, please explain what you want the keyword to do. So far you have just confused me, and I don't think I'm the only one. You have said that constants can be rebound to new values, but then you say they are used to stop them from being overridden. You said that constants act just like literals, but you won't tell us how literals act. Let me see if I can get some clarity: If I define a constant: constant pi = 3.14 what happens when I try to rebind it later? # later pi = 3.1415
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.
The Windows registry isn't a class. The Windows registry doesn't prevent you from changing values or deleting keys. If the keys and values in the registry were constant, then you couldn't control the behaviour of Windows, or install new applications, drivers, printers, hardware, etc. So I don't think the registry is a good example. -- Steve