#!/usr/bin/python
class Set:
	def __init__(self,value= []):
		self.data = []
		self.concat(value)
	def intersect(self,other):
		res = []
		for x in self.data:
			if x in other:
				res.append(x)
		return Set(res)
	def union(self,other):
		res = self.data[:]
		for x in other:
			res.append(x)
		return Set(res)
	def concat(self,value):
		for x in value: 
			if not x in self.data:
				self.data.append(x)
	def __len__(self):	return len(self.data)
	def __getitem__(self,key):	return self.data[key]
	def __and__(self,other):	return self.intersect(other)
	def __or__(self,other):		return self.union(other)
	def __repr__(self):	return '<Set:' + `self.data` + '>'
def main():
	print "starting main"
	s=Set(['Bob','Emily','Howard'])
	print "s = " , s
	print "length(s)= " , len(s)
	t=Set(['Jerry','Howard','Carol'])
	print "t = " , t
	u = s & t
	o = s | t
	print "len(u)=",len(u),u
	print "len(o)=",len(o),o
if __name__ == '__main__': main()
