Getting not derived members of a class

Reinhold Birkenfeld reinhold-birkenfeld-nospam at wolke7.net
Mon Aug 1 12:02:20 EDT 2005


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.Frame, 
> I always get the 200 or so suggestions,
> whereby most times, I'm only interested in the possible completions of
> wx.Frame and maybe wx.TopLevelWindow.

You can, of course, always search the base classes and subtract the two sets
(all members)-(members of baseclasses). For example:

cls = wx.Frame

set(dir(cls)) - reduce(set.union, [set(dir(base)) for base in cls.__bases__])

Reinhold



More information about the Python-list mailing list