C macros in Python.

Burkhard Kloss bk at xk7.com
Tue Oct 17 06:30:35 EDT 2000


> On a different, but related, topic...I sometimes miss C's #define
> macro.  There doesn't seem to be any similar thing in Python capable of
> creating identifiers which are 1) constant, that is, "read only", and 2)
> truly global in scope.
How about defining a function that returns the value?  that would make it
nicely read-only.

define pi(): return 3.14....







More information about the Python-list mailing list