yet 'nother newbie question

William J. King wjk at
Sat Nov 27 14:25:04 EST 1999


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
available to determine it's type. The only way I can figure is to use
'try' and
'except' for a partial solution:

    x = x + ""    # suceeds then its a string -- if so
   x = string.atoi(x)
    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
types and work with variables without having to resort to exception
Hope this makes sense... Thanks.....

More information about the Python-list mailing list