[Tutor] replacement for constants from other languages in Python?

2005-01-06 Thread Scott W
Hey all, I've done the usual googling, checked the Learning Python book and did some list searches, to no avail as of yet. I'm _very_ used to using C style constants (preprocessor #define directives) or C++ const keyword style, for a variety of reasons. I've yet to see anything covering 'how

Re: [Tutor] replacement for constants from other languages in Python?

2005-01-06 Thread Kent Johnson
Scott W wrote: The 'need' to define a global constant in an imported module, for example- (I know about sys.version_info, but it doesn't exist in 1.5.2...don't ask ;-) I also know this could be handled via a class, but what is the equivalent of the following snippets? Not so interested in

Re: [Tutor] replacement for constants from other languages in Python?

2005-01-06 Thread Scott W
Kent Johnson wrote: Scott W wrote: The 'need' to define a global constant in an imported module, for example- (I know about sys.version_info, but it doesn't exist in 1.5.2...don't ask ;-) I also know this could be handled via a class, but what is the equivalent of the following snippets? Not

Re: [Tutor] replacement for constants from other languages in Python?

2005-01-06 Thread Alan Gauld
I'm _very_ used to using C style constants (preprocessor #define directives) or C++ const keyword style, for a variety of reasons. I've yet to see anything covering 'how to work around the lack of constants in Python'...can anyone point me in the right direction here? Define Constants in

Re: [Tutor] replacement for constants from other languages in Python?

2005-01-06 Thread Danny Yoo
On Thu, 6 Jan 2005, Alan Gauld wrote: I'm _very_ used to using C style constants (preprocessor #define directives) or C++ const keyword style, for a variety of reasons. I've yet to see anything covering 'how to work around the lack of constants in Python'...can anyone point me in the

Re: [Tutor] replacement for constants from other languages in Python?

2005-01-06 Thread Kent Johnson
Danny Yoo wrote: There are a few recipes in the Python Cookbook that mentions how to get a const mechanism in Python: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65207 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/197965 These require Python 2.1 and 2.3 respectively;

Re: [Tutor] replacement for constants from other languages in Python?

2005-01-06 Thread Alan Gauld
Compared to Java and C++, Python has very meager facilities for controlling how code is used. There is no const, and only the slightest nod to access control my suggestion is, just relax and try the Python way! I'll second that. I came to Python after years of C++ (and Pascal - even