[FRPythoneers] instance question

Karl Putland kperacles at yahoo.com
Sun Mar 17 11:31:11 MST 2002


It would be ideal if this function would return the Super classes
in the correct class search order.

--Karl

--- Mike Olson <Mike.Olson at fourthought.com> wrote:
> On Sun, 2002-03-17 at 10:39, Evelyn Mitchell wrote:
> > I know you can use isinstance(object, class) to find out if
> object is an
> > instance of class (or of a subclass of class).
> > 
> > Is there any way to find out all the classes that object may be
> an instance
> > of?
> > 
> > Bicycle Repair is streching me again.
> 
> You would need to walk the tree by hand, or write a quick routine
> to
> flatten it.  I don't know of anything builtin
> 
> def Flatten(klass):
>     instances = []
>     for sub in klass.__bases__:
>         instances.append(sub)
>         instances.extend(Flatten(sub))
>     return instances
> 
> print Flatten(inst)
> 
> Mike
> 
> > 
> > -- 
> > Regards,                    tummy.com, ltd 
> > Evelyn Mitchell             Linux Consulting since 1995
> > efm at tummy.com               Senior System and Network
> Administrators
> >                             http://www.tummy.com/
> > _______________________________________________
> > This message sent by the FRPythoneers mailing list.
> > Unsubscribe: echo unsubscribe |
> FRPythoneers-request at lists.community.tummy.com
> > URL:
> http://lists.community.tummy.com/mailman/listinfo/frpythoneers
> -- 
> Mike Olson                                Principal Consultant
> mike.olson at fourthought.com                +1 303 583 9900 x 102
> Fourthought, Inc.                         http://Fourthought.com 
> 4735 East Walnut St,                      http://4Suite.org
> Boulder, CO 80301-2537, USA
> XML strategy, XML tools, knowledge management
> 
> _______________________________________________
> This message sent by the FRPythoneers mailing list.
> Unsubscribe: echo unsubscribe |
> FRPythoneers-request at lists.community.tummy.com
> URL:
http://lists.community.tummy.com/mailman/listinfo/frpythoneers


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/



More information about the FRPythoneers mailing list