#On the name of ALLAH #Author : Fouad Teniou #Date : 23/09/08 #Version 2.4 import math as m Class Ellipse: """ Class that represent an ellipse """ def __call__(self,**kargs): # ** allows to convert from keywords to dictionary """ Python run __call__ method for function call expressions applied to instance """ self.kargs = kargs self._a = "%2.1f" self._b = chr(253) self._c = self._a% m.sqrt(self.kargs.get('a')) self._d = self._a% m.sqrt(self.kargs.get('b')) self._e = self._a% m.sqrt(abs(self.kargs.get('a') - self.kargs.get('b')) self._f = self._a% m.sqrt(abs(self.kargs.get('b') - self.kargs.get('a')) #Determine if Ellipse equation should be displayed, based on keysâ€™ values if (len(kargs) == 2 and self.kargs.has_key('a') and self.kargs.get('a') != 0 and self.kargs.has_key('b') and self.kargs.get('b') !=0 and self.kargs.get('a') != self.kargs.get('b')): if self.kargs.get('a') > self.kargs.get('b'): self._e else: self._f #raise ValueError if one or more of keysâ€™ values are not appropriate else: raise ValueError, \ ("\n self.kargs.get('b') return "\n