Is this an Bug in python 2.3??

Balaji balaji at email.arizona.edu
Fri Jun 11 15:06:55 EDT 2004


Hello,

here is the code..

class E:
	def __init__(self):

        def relationalOperators(self,op,rightOperand):
		e=E()
		e.operator =op
		e.left=self
		e.right=rightOperand
        def __ge__(self,g1):
		return self.relationalOperators('>=',g1)
	def __le__(self,g1):
		return self.relationalOperators('<=',g1)
class V(E):
	""" This is a variable for MPY"""
	def __init__(self,domain=Continuous,lb=0,ub=Infinity):
		print "V",
		self.domain = domain
		E.__init__(self)
		self.hasVar = True
		self.val = None
    
	def __str__(self):
		if self.val:
#			print "self.val *****"
			return str(self.val)
		else:
			return findRefTo(self) or "MPY Error! Printing unnamed variable." 

Now x=V() instance of class variable..

e1=100>=x

no if i say something like this

e1.operator
it returns

'<='

but if i say e1=x>=100

e1.operator

it returns '>='

How do i overcome this ...

Balaji



More information about the Python-list mailing list