Created
February 26, 2015 04:53
-
-
Save hyunjun/794f2bffb84a28e933bc to your computer and use it in GitHub Desktop.
imp#reload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat a.py | |
class A(object): | |
def __init__(self): | |
pass | |
$ python | |
Python 2.7.8 |Anaconda 2.1.0 (64-bit)| (default, Aug 21 2014, 18:22:21) | |
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2 | |
Type "help", "copyright", "credits" or "license" for more information. | |
Anaconda is brought to you by Continuum Analytics. | |
Please check out: http://continuum.io/thanks and https://binstar.org | |
>>> from a import A | |
>>> import imp | |
>>> imp.reload(a) | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
NameError: name 'a' is not defined | |
>>> import a | |
>>> a.A | |
<class 'a.A'> | |
>>> imp.reload(a) | |
<module 'a' from 'a.pyc'> | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment