Re: defining module constants

Greg Ewing <[email protected]>
Newsgroups gmane.comp.python.pyrex
Message-ID <[email protected]>
Rob Shortt wrote:

> How about public readonly?

 From Python's point of view, they're just names in the
module dict, so there's no straightforward way of making
them readonly.

Maybe Pyrex could use some special subclass for its
modules that allows making names readonly, but I'm not
sure it's worth the bother. Every other module (whether
Python or builtin) currently has the exact same
"problem", and people seem to cope with it okay.

Note that it will only affect the value seen by Python
code, and won't mess up the internal operation of the
module (as long as the Pyrex code refers to the original
C constant and not the module variable).

-- 
Greg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.