We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f6902f9 commit 7f0c574Copy full SHA for 7f0c574
sampleclass.py
@@ -0,0 +1,23 @@
1
+# SAMPLE CODE TO ILLUSTRATE CLASSES IN PYTHON
2
+
3
4
5
+class TheThing(object):
6
+ def __init__(self):
7
+ self.number = 0
8
+ def some_function(self):
9
+ print "I got called."
10
+ def add_me_up(self, more):
11
+ self.number += more
12
+ return self.number
13
+# two different things
14
+a = TheThing()
15
+b = TheThing()
16
+a.some_function()
17
+b.some_function()
18
+print a.add_me_up(20)
19
20
+print b.add_me_up(30)
21
22
+print a.number
23
+print b.number
0 commit comments