← Projects

Update 00-Undertanding-Classes.py

da8595654b9f1b0dc55b57f02e397b4e6ab6482a · Ovidiu Constantinescu · May 22, 2015 00:28

+1 · 1 file changed

  • 00-Undertanding-Classes.py +1 −0
diff --git a/00-Undertanding-Classes.py b/00-Undertanding-Classes.py
index 9f652d5..a3071b8 100644
--- a/00-Undertanding-Classes.py
+++ b/00-Undertanding-Classes.py
@@ -37,4 +37,5 @@ print type(a), type(a.r), type(a.i), a.r, a.i
 """
 The only operations understood by instance objects are attribute references.
 There are two kinds of valid attribute names, data attributes and methods.
+http://www.pythontutor.com/visualize.html#code=class+MyClass%3A%0A++++%22%22%22A+simple+class%22%22%22%0A++++i+%3D+12345%0A%0A++++data+%3D+%5B2,3,4,5,6%5D%0A++++def+__init__(self)%3A%0A++++++++%22%22%22Methods%22%22%22%0A++++++++self.data+%3D+%5B1,2,3,4,5%5D%0A%0A++++def+f(self)%3A%0A++++++++return+%22Hello+World%22%0A%0Ax+%3D+MyClass()%0Ay+%3D+MyClass%0Aprint+x.f()%0A%0Aclass+initargu%3A%0A++++def+__init__(self,+realpart,+imagipart)%3A%0A++++++++self.r+%3D+realpart%0A++++++++self.i+%3D+imagipart%0A++++++++%0Aa+%3D+initargu(3.0,-4.5)&mode=display&origin=opt-frontend.js&cumulative=false&heapPrimitives=false&textReferences=false&py=2&rawInputLstJSON=%5B%5D&curInstr=0
 """