Why not 3.__class__ ?

Walter Dörwald walter at livinglogic.de
Fri Oct 12 06:20:05 EDT 2001


Guido van Rossum wrote:

>>instead of using a second idiom for builtins
>>
>>import types
>>isinstance(x,types.IntType)
>>. . .
>>
> 
> I find the ''.__class__ form butt-ugly, and would recommend type('')
> instead.  Fortunately, in 2.2 there are built-in names that express
> these types much clearer:
> 
> isinstance(x, str)
> isinstance(x, int)
> isinstance(x, list)
> isinstance(x, tuple)
> isinstance(x, dictionary)


The only type still missing is module (at least for type checks, I don't 
  know what the factory function module should do, and how deriving from 
module would be useful).

Bye,
    Walter Dörwald





More information about the Python-list mailing list