-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnamespace.py
More file actions
46 lines (36 loc) · 868 Bytes
/
Copy pathnamespace.py
File metadata and controls
46 lines (36 loc) · 868 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
#!/usr/bin/python
#
# Creat Time :Mon 11 Nov 2013 04:40:41 AM GMT
# Author : lili
class For_sum:
sum = 0
def __init__( self, name ):
'''Initializes the name.'''
self.name = name
print '(Initializing %s)' % self.name
For_sum.sum += 1
def __del__(self):
'''I'm dying.'''
print '%s says bye.' % self.name
For_sum.sum -+ 1
if For_sum.sum == 0:
print 'I\'m the last one.'
else:
print "There are still %d perple left." % For_sum.sum
def sayHi(self):
'''Greeting by person.'''
print 'Hi, my name is %s.' % self.name
def howMany(self):
'''Prints the current population.'''
if For_sum.sum == 1:
print 'I\'m the only person here.'
else:
print 'We have %d persons here.' % For_sum.sum
lili = For_sum( 'lili' )
lili.sayHi()
lili.howMany()
cici = For_sum( 'cici' )
cici.sayHi()
cici.howMany()
lili.sayHi()
lili.howMany()