[python-nl] Python-nl Digest, Vol 67, Issue 5

Floris van Manen vm at klankschap.nl
Tue Dec 22 12:56:14 CET 2009


On Dec 22, 2009, at 12:31, Floris van Manen wrote:

class OpEnAf:
	def __init__(self, v)
		self.v = v
	def erbij(self, x):
		self.v += x
	def eraf(self, x):
		self.v -= x
	def show(self):
		print 'Tussenstand:', self.v

a = OpEnAf( 10 )
a.show()

a.erbij(100)
a.show()

a.eraf(20)
a.show()

for i in range(10):
	a.erbij(i)
	print i, 'erbij is', a.v

a.show()





More information about the Python-nl mailing list