A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-March/043386.html below:

[Python-Dev] unexpected reload() behavior

[Python-Dev] unexpected reload() behavior [Python-Dev] unexpected reload() behaviorSkip Montanaro skip at pobox.com
Sun Mar 21 11:16:36 EST 2004
    >> It seems counterintuitive to me that reloadtst.b should still be
    >> defined.  Is that behavior intention or accidental?

    Guido> Intentional.  A module's __dict__ is not emptied when the
    Guido> reloaded module is executed.  This allows code like this (which I
    Guido> have written) that preserves a cache across relaod() calls:

    Guido>     try:
    Guido>         cache
    Guido>     except NameError:
    Guido>         cache = {}

Thanks.  I saw that in the doc shortly after posting.  I hope you don't mind
that I just added that example to the doc.

Skip


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4