How to give a custom object instance a type name ?

Ulrich Petri ulope at gmx.de
Mon Jul 14 08:22:01 EDT 2003


"Graeme Matthew" <gsmatthew at ozemail.com.au> schrieb im Newsbeitrag
news:DAwQa.168$O05.9536 at nnrp1.ozemail.com.au...
>
> Here is a custom Dispatcher class that I have written
>
> >>> from BI.System.Controller.Dispatcher import Dispatcher
> >>> x = Dispatcher()
> >>> type(x)
> <type 'instance'>

You did Java before ;)?

> 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 ?
>

how about
>>> x.__class__.__name__

HTH
Ciao Ulrich






More information about the Python-list mailing list