global myfunc; def myfunc():
Gordon McMillan
gmcm at hypernet.com
Thu Jul 29 07:57:15 EDT 1999
Bruce Dodson wrote:
> I have noticed that, when using python as an embedded language in
> another program, using a temporary dictionary for a private
> namespace, and using __main__'s dictionary for my global namespace,
> I can say:
>
> global myfunc
> def myfunc():
> ...
>
> to bind myfunc into the global namespace, which allows it to persist
> across calls. But I want to make sure that is "intended behavior"
> and not just some implementation quirk, so I can decide whether to
> document that as a feature.
It may be an unusual use, but there's nothing quirky about the
mechanism being used. You're safe.
- Gordon
More information about the Python-list
mailing list