[Tutor] What I do wrong

Grigor Kolev grigor.kolev at gmail.com
Sun Dec 13 12:25:30 CET 2009


class MyList ():
	def __init__(self, value):
		self.value = []
		for x in value:
			self.value.append(x)
	def __add__(self , other):
		return MyList(self.value+other)
	def __mul__(self , other):
		return MyList(self.value*other)
	def __getitem__(self , item):	
		return MyList(self.value+item)
	def __len__(self ):
		return len(self.value)
	def __getlice__(self , low, high):
		return MyList(self.value[low:high]
	def append(self , other):
		self.list=self.list.append(other)
		return self.list 
	def __getattr__(self , name):
		return getattr(self.value, name)
	def __repr__(self  ):
		return 'self.value'
-- 
Grigor Kolev <grigor.kolev at gmail.com>



More information about the Tutor mailing list