sufficiently pythonic code for testing type of function

Theerasak Photha hanumizzle at
Wed Oct 11 11:13:54 CEST 2006

On 10/11/06, Fredrik Lundh <fredrik at> wrote:

> can be a lot better than a 30-level traceback that ends with a line
> looking something like
>      fnut.index(gah)

Despite long experience with Perl, I am not a big follower of the
"goose_level: blah" method of error reporting...

> also, checking for __method__ is, in general, not the right way to check
> if an object implements a given interface.

I had a vague feeling it might not be a Right Thing(tm).
<flame-proof-underwear>I kind of miss

> so if you can, try doing the operation instead, and catch error (if you
> really need to check first, use an idempotent operation, if available).

I'll do that as soon as my green noggin figures out what 'idempotent' means.

Serves me right for being a liberal arts weenie:

-- Theerasak

More information about the Python-list mailing list