Is 'isinstance()' the right thing?
Ralf Juengling
juenglin at informatik.uni-freiburg.de
Tue Apr 30 08:34:49 EDT 2002
Erik Max Francis <max at alcyone.com> writes:
> Ralf Juengling wrote:
>
> > So, what is the proper, 'pythonic' way of argument checking?
>
> The "Pythonic" way of argument checking is to simply use it and catch
> the exceptions that will be thrown if it doesn't behave as planned.
Hm, you might risk to destroy something this way (i.e. when an exception
occurs to late).
>
> Depending on what you want, some of the is... functions in the operator
> module might be to your liking.
Thanks, I wasn't aware of these (looked for them in the type module).
*BUT*, these (eg. isSequenceType) work only for C extension types, right?
Ralf
More information about the Python-list
mailing list