How do you create constants?
marc cheatham
marcc at yieldworks.com
Sat Oct 28 13:27:17 EDT 2000
More information about the Python-list mailing list
Sat Oct 28 13:27:17 EDT 2000
- Previous message (by thread): How do you create constants?
- Next message (by thread): How do you create constants?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
For safety. I like knowing there is no way for myself or anyone else can modify this value at run time. These types of bugs can be very hard to find, especially in large projects. By making them immutable you avoid the problem of someone modifying your constant, you always know what that value will be. I do not like global variables and only use them when I have no other choice. With Python it seems you are forced to use global variables as constants which opens yourself up to lots of potential problems. I think this is one of the few drawbacks of Python. A good discussion on global variables can be found in "Code Complete" by Steve McConnell. I also agree with Fredrik, this and enums would be a very features to add to Python 2.2 Marc Fredrik Lundh wrote: > Tom Wright wrote: > > shame they cant be made immutable once they have been set, > > feature for 2.1 ??? ;-) > > can you explain why you think you need immutable > "constants"? > > </F>
- Previous message (by thread): How do you create constants?
- Next message (by thread): How do you create constants?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list