yet 'nother newbie question
Alan Gauld
alan.gauld at gssec.bt.co.uk
Mon Nov 29 12:49:24 EST 1999
William J. King wrote:
> 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...
Another poster answered this.
However be careful that your not trying to use Python like C++
Static typing is useful in C++ but dynamic typing is much
better for Python's typical applications. More flexible and
faster to develop. Rather than using try/except to test types
use it to catch the few occasions when a bad typ[e is passed.
Your fellow programmers are not totally stupid and will by
and large try to pass the right thing. If you catch the
errors it usually works...
If you do need to check the type then type() is your friend.
Alan G.
--
=================================================
This post represents the views of the author
and does not necessarily accurately represent
the views of BT.
More information about the Python-list
mailing list