[Python-Dev] Re: Capabilities - published interfaces

Aahz aahz at pythoncraft.com
Sat Dec 20 09:08:43 EST 2003


On Sat, Dec 20, 2003, Luke Kenneth Casson Leighton wrote:
>
> one of the things that is strangely lacking in python is the ability
> to restrict access to python objects, a la public, protected and
> private from c++.
>
> perl users find this to be utterly incomprehensible and reprehensible,
> especially the bits where conventions are obeyed - and followed! -
> about putting underscores in front of function names.
>
> from a restricted execution perspective, this is not really okay.

Yup.  That really is the fundamental issue.  Python has been deliberately
designed to let programmers do whatever they want; it's a "let the
grownups play" perspective.  That's part of the reason restricted
execution hasn't received more attention: it's fundamentally opposed to
Python's design.  Another major reason is because restricted execution
from within Python can never completely solve the problem unless we
devote vast amounts of effort.  Consider the following two snippets of
code:

    100 ** 100 ** 100
    [None] * (10 ** 10)

The first chews up CPU; the second chews up memory.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Weinberg's Second Law: If builders built buildings the way programmers wrote 
programs, then the first woodpecker that came along would destroy civilization.



More information about the Python-Dev mailing list