[Python-Dev] PEP 318: Security use case

Ka-Ping Yee python-dev at zesty.ca
Tue Mar 30 06:17:26 EST 2004


Here is an additional simple use case you could consider.

    def private(cls):
        def instantiate(*args, **kw):
            return cls(*args, **kw)
        return instantiate

    class DontTouch [private]:
        ...

Inner scopes are one of the best places to hide things in Python;
they are very difficult to get at.  (I can't seem to find any
special attributes that access the values inside them, and even
if there is a way, it would be easy to imagine a restricted
execution mode that wouldn't expose them.)


-- ?!ng



More information about the Python-Dev mailing list