Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #### mymodule.py ####
- class ExampleClass(object):
- pass
- #### example.py ####
- # Anything imported using a from statement does not get
- # reloaded when the enclosing module is reloaded.
- from mymodule import ExampleClass
- import mymodule
- a = ExampleClass()
- b = mymodule.ExampleClass()
- print id(ExampleClass)
- print id(mymodule.ExampleClass)
- print id(a.__class__)
- print id(b.__class__)
- reload(mymodule)
- print '----------'
- print id(ExampleClass)
- print id(mymodule.ExampleClass), "<----- look!"
- print id(a.__class__)
- print id(b.__class__)
Add Comment
Please, Sign In to add comment