pythonic way to optimize access to imported value?

Bengt Richter bokr at oz.net
Thu Nov 14 06:08:22 EST 2002


On 14 Nov 2002 09:29:21 GMT, bokr at oz.net (Bengt Richter) wrote:
[...]
>
>To avoid the global temp, I suppose you could write
>
>    def foo():
>        const pi = [__import__('math')][0].pi
or, less ridiculously,
         const pi = __import__('math').pi
;-/
>        const seven = 7

Regards,
Bengt Richter



More information about the Python-list mailing list