How to give a custom object instance a type name ?

Graeme Matthew gsmatthew at ozemail.com.au
Mon Jul 14 14:29:25 CEST 2003


works fine, ta

x.__class__.__name__
'Dispatcher'
>>>
"Ulrich Petri" <ulope at gmx.de> wrote in message
news:beu76g$8t8vu$1 at ID-67890.news.uni-berlin.de...
> "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