PEP 318: Security use case

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

On Tue, 2004-03-30 at 06:17, Ka-Ping Yee wrote:
It's by design that there is no meta way to get at bindings for free variables. I don't think I said anything about at in the PEP, but I was thinking of JAR's thesis (http://mumble.net/~jar/pubs/secureos/). Jeremy

At 09:06 30.03.2004 -0500, Jeremy Hylton wrote:
the only way I know to get at them is something like this (someone once asked on comp.lang.python):
so yes: they are difficult to get at, it's easy to imagine a restricted execution mode that wouldn't expose them, i.e. that wouldn't be hard part of such a design.

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

On Tue, 2004-03-30 at 06:17, Ka-Ping Yee wrote:
It's by design that there is no meta way to get at bindings for free variables. I don't think I said anything about at in the PEP, but I was thinking of JAR's thesis (http://mumble.net/~jar/pubs/secureos/). Jeremy

At 09:06 30.03.2004 -0500, Jeremy Hylton wrote:
the only way I know to get at them is something like this (someone once asked on comp.lang.python):
so yes: they are difficult to get at, it's easy to imagine a restricted execution mode that wouldn't expose them, i.e. that wouldn't be hard part of such a design.

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
participants (4)
-
Jeremy Hylton
-
Ka-Ping Yee
-
Samuele Pedroni
-
Skip Montanaro