What is the command to determine an object's type?

MDK mdk at mdk.com
Tue Feb 5 16:33:30 EST 2002

"Mark McEahern" <marklists at mceahern.com> wrote in message
news:mailman.1012942149.18474.python-list at python.org...
> > MDK wrote:
> > How can I tell if an object is a string, a list, or a dictionary in a
> > program using if and ifelse so that I can perform a differnent action
> > depending on the object's type?
> I posted code that will do the trick and then realized, I should probably
> add this...
> It goes without saying, of course, that you may want to investigate the
> Strategy design pattern.  Eliminating that sort of conditional type
> is Strategy's strong suit.
> Cheers,
> // mark

The code that you posted made perfect sense; thanks for that.  However, I am
not clear about what you are talking about in regards to "...the Strategy
design pattern."

I would like to investigate it but I do not know what it is I am
investigating.  Can you clarify a little more for me?


More information about the Python-list mailing list