Skip to content

Instantly share code, notes, and snippets.

@hyunjun
Created February 26, 2015 04:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyunjun/794f2bffb84a28e933bc to your computer and use it in GitHub Desktop.
Save hyunjun/794f2bffb84a28e933bc to your computer and use it in GitHub Desktop.
imp#reload
$ 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