class pairoptions:
	#properties
	def __init__(self,*args):
		# {{{ Properties
		if len(args)%2==1:
			raise RuntimeError('pairoption error message: an even number of options is required')

		#create a pairoption object
		if len(args)==0:
			self.list=[]
		else:
			self.list=[]
			for i in range(int(round(len(args)/2))):
				if isinstance(args[2*i],str):
					self.list.append([args[2*i],args[2*i+1]])
				else:
					#option is not a string, ignore it
					print("%s%i%s"%('buildlist info: option number ',i,' is not a string, it will be ignored'))
					continue

		#}}}
	def __repr__(obj):
		# {{{ Display
		if not obj.list:
			string='   list: empty'
		else:
			string="   list: (%i)"%(len(obj.list))
			for i in range(len(obj.list)):
				if isinstance(obj.list[i][1],str):
					string2="     field: %-10s value: '%s'"%(obj.list[i][0],obj.list[i][1])
				elif isinstance(obj.list[i][1],float):
					string2="     field: %-10s value: %g"%(obj.list[i][0],obj.list[i][1])
				elif isinstance(obj.list[i][1],int):
					string2="     field: %-10s value: %i"%(obj.list[i][0],obj.list[i][1])
				else:
					string2="     field: %-10s value: (%i)"%(len(obj.list[i][1]))
				string="%s\n%s"%(string,string2)
		return string
