[Python-Dev] PEP 318: Security use case (original) (raw)

Skip Montanaro skip at pobox.com
Thu Apr 8 17:34:55 EDT 2004


Ping> Here is an additional simple use case you could consider.

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

Ping>     class DontTouch [private]:
Ping>         ...

Ping> Inner scopes are one of the best places to hide things in Python;
Ping> they are very difficult to get at.

Are you using "private" to mean "can't be subclassed"? I'm not sure that's the correct term to use here. I guess I'm interpreting "private" in the C++ sense of the word.

Skip



More information about the Python-Dev mailing list