Know if a object member is a method

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Mon Sep 1 14:11:38 CEST 2008


On Mon, 01 Sep 2008 11:45:36 +0200, Luca wrote:

>> But not so easy to fool a type check:
>>
>>>>> type(x) == new.function
>> False
>>
>> Of course that's not bullet-proof either. I leave it as an exercise to
>> discover how you might break that piece of code.
>>
>>
> Ok, so...
> 
> What is the best way to do this? The "most pythonic"?

The "most pythonic" might be not checking at all but simply *call* the 
object and deal with possible failures.

What's your use case?

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list