Execfile() - bug / strange behavior

Tim Peters tim_one at email.msn.com
Sat Feb 5 03:01:23 EST 2000


[Amit's execfile woes]

[Tim]
> You can't actually get the timbot interested in pursuing this, since
> it never uses these things without explicity naming the dicts it
> wants used as execution context.

[Carel Fellinger]
> And how then would it pass on the locals dict in this case?

It wouldn't:  as a bot, it's incapable of wholly irrational behavior <wink>.
Executing blobs of unknown code for their side-effects on local vrbls is at
the very best extremely questionable practice.  "Dark and useless" is fun,
but should be done in pvt -- like all other masturbatory practices.

> According to the docs, and a recent explanation on this list, it is
> not possible to use something like
> execfile("1.txt", globals(), locals()),
> as those are readonly in case of functions! One of the few dark
> corners of Python IMHO.

More a dark corner of the human soul, that someone would want to try that --
Python lovingly intervenes, saying "beyond this line, thou shall not
cross!".  Until you download bytecodehacks, anyway <wink>.

as-a-language-of-the-world-python-can't-keep-out-the-devil-
    but-as-a-language-of-god-it-handcuffs-the-beast-ly y'rs  - tim






More information about the Python-list mailing list