[IPython-User] ipython3 notebook does not load attributes from class = AttributeError: but it works fine in IDLE3 (Thomas Kluyver)

Matthias BUSSONNIER bussonniermatthias@gmail....
Tue Mar 19 11:58:12 CDT 2013


Dear Dennis, 

I think you are confused by the fact that execution order might not be cell order. 

Rule of thumb, when you have strange behavior, restart the kernel, and execute things linearly on your notebook.
and check that it is reproducible, with consecutive prompt number starting from 1.
Bonus, you can put your notebook on nbviewer to share, it's easier to test as we can download it.

You are starting by executing cell with prompt 29, that becomes cell 22 afterward. 
So you probably restarted your kernel in the meantime, i.e. what is shown can not reflect the status of the kernel
so it is harder to interpret. 

Here it was meaning that the student2 when you <tab> is NOT the same object before and after you execute cell 29. 

Second, <bound methods> is not an error, you are calling a method so you should add the () to get the result, or make it a property. Otherwise the return value is the repr of a function.

Once You changed student2 after executing  cell 29 (now 22) it is normal to have the completion. 


I'll recall your execution temporarily in pseudo-python.

------
class student: 
	property : attend

student1 = new Student()
student2 = newStudent()
----
then 
----
class student: 
	property : attend
	method : attendDay
----
Then try to complete student2 (obviously no attendDayMethod)
An execute the following (which recreate student 2)
----
student2 = new Student(Mikeasdasd)
student2.attendDay
----
Which show that student2.attendDay is a method of student object … nothing storage about
try attendDay On student1… of course does not existm still count to first defined class. 
----
try to complete on student2, which is new class, of course you get the new attribute.
----

So I don't see where the problem is, this a perfect valid python behavior. 
You are just confused py the order in which you created class and object. 

-- 
Matthias




Le 19 mars 2013 à 17:29, Dennis Daniels a écrit :

> Hello Thomas, 
> I reloaded the ipython3 and the ipynb and was still throwing the "the no attribute " error but then, the attributes started to show up! Very strange.
> 
> You'll see the same behavior in the video.
> http://youtu.be/U3RmySQLtgM @ 1:17
> 
> thanks
> Dennis
> 
> 
> 
> 
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20130319/b3ffd96a/attachment.html 


More information about the IPython-User mailing list