verify the return value of a function
Mel Wilson
mwilson at the-wire.com
Fri Jan 20 08:53:13 EST 2012
Jean-Michel Pichavant wrote:
> isinstance is fine, if you could find the source where it is
> discouraged... Could be a consequence of some specific context.
> However, checking types in OOP is in general a failure. Unitary tests
> are possibly an exception.
I think it's discouraged when people try to write big overloaded functions
that check the types of the arguments to decide what they should be doing.
In diagnostics and tests like the OP's there should be no problem.
Mel.
More information about the Python-list
mailing list