"def" vs "sub" (was RE: More random python observations from a perl programmer)

Blake Winton bwinton at tor.dhs.org
Tue Aug 24 04:34:00 CEST 1999


On Mon, 23 Aug 1999 01:58:23 -0400, Tim Peters wrote:
>[Thomas Wouters]
>> exec "a = 1 * 10" in {}
>> or
>> exec "foo = bar * zed" in {'bar': 5, 'zed', 'z'}
>No.  It would first have to parse the exec'ed string at compile-time,
>but that's delayed to run-time, too late to help the local/global
>decisions made at compile-time.  In real execs, one or more of the
>arguments are unknown at compile-time anyway (nobody would write the
>above in a real program, but if you're the exception feel free to
>submit a tedious patch to look for stuff like that <wink>).
>most-optimizations-aren't-ly y'rs  - tim

That almost looks like a place bytecodehacks could help...

Unfortunately, my net connection seems a little flaky today, so I can't
test it out in any greater detail...

Later,
Blake.

-- 
One Will.  One Dream.  One Truth.  One Destiny.  One Love.




More information about the Python-list mailing list