deleting, then re-importing a class method

Jean-Michel Pichavant jeanmichel at sequans.com
Thu Jan 21 05:43:38 EST 2010


Robert P. J. Day wrote:
>   (once again, never ashamed to ask the dumb questions.)
>
>   still playing with python3, and testing whether i can
> delete/unimport a specific method, then re-import it:
>
>   
>>>> import sys
>>>> print(sys.__doc__)
>>>>         
> ... blah blah blah ...
>   
>>>> del(sys.__doc__)
>>>> print(sys.__doc__)
>>>>         
> module(name[, doc])
>
> Create a module object.
> The name must be a string; the optional doc argument can have any
> type.
>   
>
>   ok, now that i've deleted just that member of "sys", can i re-import
> it?  i know this doesn't seem to work:
>
>   
>>>> import sys
>>>>         
>
>   or is there an operator other than "import" that more represents a
> full refresh of a class?
>
> rday
>
> p.s.  no, i don't have a valid application of the above, i'm just
> trying to break things.
>
> --
>
>
> ========================================================================
> Robert P. J. Day                               Waterloo, Ontario, CANADA
>
>             Linux Consulting, Training and Kernel Pedantry.
>
> Web page:                                          http://crashcourse.ca
> Twitter:                                       http://twitter.com/rpjday
> ========================================================================
>   
reload(sys)

JM





More information about the Python-list mailing list