##// END OF EJS Templates
Merge pull request #11283 from oscar6echo/improve-autoreload...
Merge pull request #11283 from oscar6echo/improve-autoreload Add new methods in update_class()

File last commit:

r24521:f28c85f3
r24522:197a017e merge
Show More
improve-autoreload.md
30 lines | 830 B | text/x-minidsrc | MarkdownLexer
/ docs / source / whatsnew / pr / improve-autoreload.md
oscar6echo
Add file in whatsnew/pr
r24521 magic `%autoreload 2` now captures new methods added to classes. Earlier, only methods existing as of the initial import were being tracked and updated.
This new feature helps dual environement development - Jupyter+IDE - where the code gradually moves from notebook cells to package files, as it gets structured.
**Example**: An instance of the class `MyClass` will be able to access the method `cube()` after it is uncommented and the file `file1.py` saved on disk.
````python
# notebook
from mymodule import MyClass
first = MyClass(5)
````
````python
# mymodule/file1.py
class MyClass:
def __init__(self, a=10):
self.a = a
def square(self):
print('compute square')
return self.a*self.a
# def cube(self):
# print('compute cube')
# return self.a*self.a*self.a
````