How to give a custom object instance a type name ?

Graeme Matthew gsmatthew at ozemail.com.au
Mon Jul 14 07:35:59 EDT 2003


Hi all, quick one,

I hope I am explaining this properly, I am wanting to do some introspection
on custom object instances, for example:

 import md5
>>> m = md5.new()
>>> type(m)
<type 'md5.md5'>

I can at least test here by doing something like if type(m) == 'md5.md5':


Here is a custom Dispatcher class that I have written

>>> from BI.System.Controller.Dispatcher import Dispatcher
>>> x = Dispatcher()
>>> type(x)
<type 'instance'>

How do I get the same as with instance 'm' above where the type displays the
actual object instance name, however my
custom dispatcher instance is just a generic 'instance', is there some
builtin where this is set ?

many thanks

Graeme










More information about the Python-list mailing list