Getting not derived members of a class

Franz Steinhaeusler franz.steinhaeusler at gmx.at
Mon Aug 1 12:08:51 EDT 2005


On Mon, 01 Aug 2005 18:02:20 +0200, Reinhold Birkenfeld
<reinhold-birkenfeld-nospam at wolke7.net> 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, 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

Hello Reinhold,

yes, cool, thank you very much!

The optimum would be getting also the other base classes, with the
members, but I think, it is asked to much.

'wx.Frame' ... => CreateStatusBar, ...
'wx.TopLevelWindow' ... => GetIcon, ...
'wx.Window' ... => ...
'wx.EvtHandler' => ...

-- 
Franz Steinhaeusler



More information about the Python-list mailing list