Python type checking?

Arinte jamarijr at hotmail.com
Tue Dec 7 10:43:06 EST 1999


class PossArg:
   def __init__(self,argname, argvalue):
      self.argname = argname
      self.argvalue = argvalue

   def getValue(self):
      return self.argvalue
   def getName(self):
      return self.argname

   def setValue(self, value):
      self.argvalue = value

On the set setValue(), they set it to an integer value I want to make
it a long else if it is a string leave it as a string.  How can this be
done?  I figure I can do a if (type(argvalue)=="int"), but how would I
handle a cast in python.

TIA


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list