osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Coding technique: distinguish using type or abc?


ram at zedat.fu-berlin.de (Stefan Ram):
>     if type( object ) is list:

I would recommend isinstance() because:

   >>> isinstance(True, int)
   True
   >>> type(True) is int
   False


Marko