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
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
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
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
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
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;
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