forked from sauravtom/testing123
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclasses.py
More file actions
41 lines (27 loc) · 747 Bytes
/
classes.py
File metadata and controls
41 lines (27 loc) · 747 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
class Foo:
pass
class Pokemon:
'this class has information about pokemons'
def __init__(self, pokemon_name,pokemon_cp,pokemon_type):
self.pokemon_name = pokemon_name
self.pokemon_cp = pokemon_cp
self.pokemon_type = pokemon_type
self.__foo = 'private variable'
def displayInfo(self):
print self.__foo
print "My Pokemon is %s, with cp %s, and type is %s"%(self.pokemon_name,
self.pokemon_cp,
self.pokemon_type)
print self.foo()
def foo(self):
return 42
if __name__ == '__main__':
pikachu = Pokemon('Pikachu','100','electricity')
print pikachu.pokemon_name
#print pikachu.__foo
pikachu.displayInfo()
print dir(pikachu)
print type(pikachu)
print type(Pokemon)
print dir(Pokemon)
print pikachu.__doc__