pythonic way to optimize access to imported value?
Greg Ewing
see_reply_address at something.invalid
Wed Nov 13 19:00:32 EST 2002
Neal Norwitz wrote:
> You can *kinda* do this with 2.1 (at least) and up:
>
> >>> import math
> >>> def foo(): return foo.pi
> ...
> >>> foo.pi = math.pi
> >>> foo()
> 3.1415926535897931
But that defeats the purpose, which presumably was to
avoid a global name lookup!
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
More information about the Python-list
mailing list