[Zope] Checking variable types in Python Script

Dieter Maurer dieter@handshake.de
Mon, 9 Sep 2002 20:41:02 +0200


Johan Carlsson [Torped] writes:
 > How do I use type() in Python scripts.
You do not, it is private.
 > It seems that type() is restricted code (why?)
It would confuse many users.

 > is there any special replacement for type checking?
There is "same_type(object,sample)". It tests whether "object"
and "sample" are of the same type.

For Zope objects, you can use "meta_type" (which will usually (but not
always) give good results).


Dieter