-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobjects.py
More file actions
48 lines (33 loc) · 760 Bytes
/
objects.py
File metadata and controls
48 lines (33 loc) · 760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# objects.. classes
class Car(object):
def __init__(self):
self.color = 'blue'
class Honda(Car):
family = 'car' # attribute
def __init__(self, age, color, rims = True):
self.color = color
self.rims = rims
self.age = age # attribute
def get_age(self):
return self.age
car = Car()
civic = Honda(color = 'green', age = 12) # order doesn't matter
print car.color
print civic.color
print civic.age
print civic.family
print civic.rims
print civic.get_age()
l = range(0, 3)
def fn():
return ''
print type(1)
print type(l)
print type(True)
print type((1, 2))
print type({'name': 'phil'})
print type(set([1, 2, 3, 4, 4]))
print type(fn)
print type(Car)
print type(Car.__init__)
print type(car)