##// END OF EJS Templates
Add file in whatsnew/pr
oscar6echo -
Show More
@@ -0,0 +1,30 b''
1 magic `%autoreload 2` now captures new methods added to classes. Earlier, only methods existing as of the initial import were being tracked and updated.
2
3 This new feature helps dual environement development - Jupyter+IDE - where the code gradually moves from notebook cells to package files, as it gets structured.
4
5 **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.
6
7 ````python
8 # notebook
9
10 from mymodule import MyClass
11 first = MyClass(5)
12 ````
13
14 ````python
15 # mymodule/file1.py
16
17 class MyClass:
18
19 def __init__(self, a=10):
20 self.a = a
21
22 def square(self):
23 print('compute square')
24 return self.a*self.a
25
26 # def cube(self):
27 # print('compute cube')
28 # return self.a*self.a*self.a
29 ````
30
General Comments 0
You need to be logged in to leave comments. Login now