Re: Getting not derived members of a class

2005-08-01 Thread Brian Beck
George Sakkis wrote: z = Z() z.__class__.__mro__ > > (, , , > , ) > > Old style classes don't have __mro__, so you have to write it yourself; > in any case, writing old style classes in new code is discouraged. Notice also that George's __mro__ solution returns the bases in reverse orde

Re: Getting not derived members of a class

2005-08-01 Thread George Sakkis
Franz Steinhaeusler wrote: > Is there any possibility to simply get out > the classes and baseclasses of a class? > > somfunc (y) => class A, B (where B is last). If you use "new-style" classes, i.e. classes inheriting from object, it is trivial: class X(object): pass class Y1(X): pass

Re: Getting not derived members of a class

2005-08-01 Thread Franz Steinhaeusler
On Mon, 01 Aug 2005 18:02:20 +0200, Reinhold Birkenfeld <[EMAIL PROTECTED]> wrote: >Franz Steinhaeusler wrote: > >> The background: >> I want to create a code completition for an editor component. >> It should distinguish between inherited and non inherited members. >> Reason is, that on wxPython,

Re: Getting not derived members of a class

2005-08-01 Thread Franz Steinhaeusler
On Mon, 1 Aug 2005 10:24:53 -0500, Jeff Epler <[EMAIL PROTECTED]> wrote: >On 'y', Python has no way of recording where '_a' and '_b' were set, so >you can't tell whether it comes from class 'a' or 'b'. > >You can find the attributes that are defined on 'b' only, though, by >using 'b.__dict__.keys(

Re: Getting not derived members of a class

2005-08-01 Thread Reinhold Birkenfeld
Franz Steinhaeusler wrote: > The background: > I want to create a code completition for an editor component. > It should distinguish between inherited and non inherited members. > Reason is, that on wxPython, most classes are derived from wxWindow. > For example if I want Code completition for wx.

Re: Getting not derived members of a class

2005-08-01 Thread Jeff Epler
On 'y', Python has no way of recording where '_a' and '_b' were set, so you can't tell whether it comes from class 'a' or 'b'. You can find the attributes that are defined on 'b' only, though, by using 'b.__dict__.keys()', or 'y.__class__.__dict__.__keys__()'. This gives ['__module__', 'who1'

Re: Getting not derived members of a class

2005-08-01 Thread Franz Steinhaeusler
On 1 Aug 2005 07:43:22 -0700, "George Sakkis" <[EMAIL PROTECTED]> wrote: >Franz Steinhaeusler wrote: > >> Hello NG, >> >> I want to retrieve the members of a class >> with a baseclass. >> But the problem is, how to get the non derived >> members. >> >> class a: >> def who(self): >> pri

Re: Getting not derived members of a class

2005-08-01 Thread George Sakkis
Franz Steinhaeusler wrote: > Hello NG, > > I want to retrieve the members of a class > with a baseclass. > But the problem is, how to get the non derived > members. > > class a: > def who(self): > print "who" > def __init__(self): > self._a = 3 > > class b(a): > def who

Getting not derived members of a class

2005-08-01 Thread Franz Steinhaeusler
Hello NG, I want to retrieve the members of a class with a baseclass. But the problem is, how to get the non derived members. class a: def who(self): print "who" def __init__(self): self._a = 3 class b(a): def who1(self): print "who1" def __init__(self):