[Pyrex] defining module constants

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Apr 12 05:21:51 CEST 2008


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



More information about the Pyrex mailing list