yes, with metaclasses (was Re: Read-only class definitions?)
phr-n2002b at NOSPAMnightsong.com
Fri Oct 11 18:07:43 CEST 2002
Alex Martelli <aleax at aleax.it> writes:
> Why one would want to consider users of your libraries
> as being BY DEFAULT adversaries devoted to the task of
> breaking them, I'm not sure, but it seems to be a widespread
> mentality. In general, if your libraries' users are known
> to be inimical and bent on destruction, Python may not be
> the best language for you to use, I suspect.
There are lots of situations where you have to think of the user as an
adversary. Think of a program that performs privileged operations on
the user's behalf, for example accessing the user's private data in a
database that also has data belonging to other users.
Anyway, the best way to do this kind of thing (if you want a
subroutine interface) is by running the privileged stuff in a separate
process and exposing an RPC interface. And even then, you have to be
very careful. Trying to do it in the same process (as Java tries
to let you do, with only partial success) is even more dangerous.
More information about the Python-list