using del() to 'unimport'

Jp Calderone exarkun at meson.dyndns.org
Sun Nov 24 14:40:29 EST 2002


On Sun, Nov 24, 2002 at 04:25:28AM -0800, Donnal Walter wrote:
> 
> So my question is this: Is it an acceptable Python idiom to use del()
> at the end of a module to remove previously imported names from the
> global namespace as shown below? Is there a better alternative?
> 

  It's fine.  Note that 'del' is a keyword, and makes up part of a
statement, not a function (and part of an expression).

del Useful, Mixin1

  works just as well.

  Jp

 --
 2:08am up 22 days, 13:02, 6 users, load average: 0.08, 0.10, 0.09
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20021124/f8066b69/attachment.sig>


More information about the Python-list mailing list