constant in python?

Paul Rubin phr-n2001 at nightsong.com
Sat Aug 18 13:59:17 EDT 2001


"Brian Quinlan" <BrianQ at ActiveState.com> writes:
> The questions is why do you need explicit language support for
> constants? Just don't change the value and it should behave constant
> enough for you.

I don't like the Java runtime system or the doctrinaire OO culture
that's grown up around Java, but enforcing constantness and the
privacy of non-public class instance variables and methods is one
thing the Java language did right.  It makes the "applet sandbox" a
natural idea.  This is useful not just for browser extensions, but for
programmable security coprocessors (Dallas iButton, NCipher SEE),
stored procedures in multi-user databases (Oracle 8i) and other
environments where you may want to hand a class instance to
potentially malicious code.

Perl has a "restricted execution" scheme that's pretty messy.  I
understand Python also has such a scheme, but I haven't studied it yet.



More information about the Python-list mailing list