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; the OP indicated he needs to work with 1.5.2!


But I have to admit that I don't use this approach myself; I've been using the uppercase convension, and it seems to work ok.

(To Scott, not Danny):

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 with the _ and __ naming conventions. And of course the lack of static typing limits your control over function parameters.

Although this might make you a bit nervous at first, in practice it doesn't cause problems and is very freeing.

Later versions of Python have some methods that let you build controls, as Danny pointed out, but my suggestion is, just relax and try the Python way!

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to