Wesley Brooks schrieb:
>> type(b) == classobj
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> NameError: name 'classobj' is not defined
>
> For the time being I'll use b.__name__ == b to ensure I'm getting the
> right class. Is there a reason why the other types such as bool are
> defined but classobj isn't?
In general, only those types which you also use as constructors are
builtin. I.e. you would write bool(foo) (where foo is a variable),
but you would not write classobj("bar") (to create a class named
"bar"). That you can also use it for a type test is a side-effect.
Some more types are available in the types module. In this case,
you can use types. In this case, types.ClassType would do the trick.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list