yet 'nother newbie question
William J. King
wjk at wjk.mv.com
Sat Nov 27 14:25:04 EST 1999
Hi:
When passing an argument to a function etc. -- how does one determine
that it is
an integer that is being passed and not a string for example... Is there
something
available to determine it's type. The only way I can figure is to use
'try' and
'except' for a partial solution:
try:
x = x + "" # suceeds then its a string -- if so
x = string.atoi(x)
except:
x = x + 0 #This sort of partially ensures that int is passed.....
or if you have the reverse situation?...
Hmmm -- It seems python knows the difference internally, how can I
determine
types and work with variables without having to resort to exception
checking...
Hope this makes sense... Thanks.....
More information about the Python-list
mailing list