Update locals()

holger krekel pyth at devel.trillke.net
Mon Apr 29 18:11:22 EDT 2002


On Mon, Apr 29, 2002 at 12:36:38PM +0000, Alex Martelli wrote:
[#now posted, accidentally send via private mail previously]

> The ONLY specific functionality that exec-without-explicit-dicts
> (EWOED for short) "gives" you is exactly the ability to enable such
> uncontrolled namespace alteration.  And that is exactly what makes
> it an abomination.

In many cases i agree. You showed it to me. thank you.

But sometimes abominations are exactly what you want :-)
I hardly dare to give you the following example as you
probably are going to launch some 'cruise missiles' at me:

   exec bootstrap

This is one line in a *very* simple network server that receives code
(or strings) and executes them. It's called 'bootstrap' because
you can consider this network server to be totally naked (like
a computer before an Operation system starts up). No threads,
no security, no nothing, except a socket receiving a bootstrap.

The idea is that the naked system is 'protocol-less' and the
*client brings in the protocol*. The newly arrived code can even take
over the 'sock.accept' loop and impose security restrictions
(signed code etc.).  I can show you some pretty nifty
examples at EuroPython what can be done with it. It's ongoing
experimenting research, though.

Loosing the possibility to

(a) alter locals()/globals() AND

(b) loosing EWOED semantics

would make the *basic idiom* of this approach, allowing the client
side to introduce protocols and (completly) modify behaviour of
the server, more difficult. IMHO.

> I think I'll be at EuroPython, yes, although I don't understand what
> you can possibly mean by "on the screen" in this context

I don't know. Might as well be my fault. With 'screen' i meant
'computer screen' and that we would sit in front of it with
a keyboard, scrolling in source code, hacking on the keyboard
and such things :-)

regards and thanks for your patience, anyway,

    holger





More information about the Python-list mailing list