[IPython-User] class attributes not loading in notebook

Matthias BUSSONNIER bussonniermatthias@gmail....
Sun Mar 24 09:51:07 CDT 2013


Daniel, 
Le 24 mars 2013 à 15:35, Dennis Daniels a écrit :

> Greetings
> I've brought this up before and I'm beginning to think there might be a bug with ipython3 notebook
> 
> I create a class. I save the notebook and execute the cell and yet when I try to call on the class functions, ipython3 notebook says it doesn't exist.
> 
> Please explain how to force Ipython3 notebook to recognize new functions in a class.

This has nothing to do with IPython notebook. 
This is pure python issue. 

When you modify a class you the already created object will **NOT** have the modification. 
You **HAVE TO** recreate the object.

class Dog(object):

	def bark(self):
		print "Woof"


lassy = Dog()
lassy.bark()
  -> Woof

class Dog(object):

	def bark(self):
		print "Miaou"

lassy.bark()
woof

lassy = Dog()
lassy.bark()
Miaou

**SAME** goes for completion.
-- 
Matthias






More information about the IPython-User mailing list