Exposing all methods of a class

Rick Johnson rantingrickjohnson at gmail.com
Tue Feb 28 19:16:49 EST 2017


On Sunday, February 26, 2017 at 2:15:58 PM UTC-6, Pete Dowdell wrote:
> I use Python, mainly with Django, for work. I was wondering
> if anyone has encountered an editor that could display a
> class with all inherited methods included in the editor's
> view of the class code.

Personally, i'm a minimalist when it comes to editing tools
so i don't know jack-squat about anything like that
(although the likelihood of it existing seems reasonable).
But if perusing the inter-webs for days only to become
frustrated is not your cup of java, and you dont mind
rolling your own "green snake doobie", and you're not offended
by the abysmal state of Tkinter (aka: stems-and-seeds), you
might take a look at IDLE.

Sarcastic Sam Said: "Got caveats?" o_O

IDLE has a "class browser" feature (@GUI_XY = File->
Class_Browser) that displays a GUI tree of the currently
opened module, although, and unfortunately for you, the
scope of detail ends at the physical borders of the module.
However, by utilizing the introspection power of python
(`import inspect`, for instance), you could probably
implement something akin to "comprehensive introspection
reform".

Of course, that last statement assumes you're _not_ an "all-
talk-and-no-action" code monkey.

> I am kind of envisaging the inherited code would be
> displayed differently (say, grey vs black), and labelled
> with the name of the parent class so that it would provide
> a one-stop view of the entire class structure.

Yeah, which can be quite helpful when you're trying to
understand a deeply nested object structure. And let's be
honest here... contrary to popular belief, it's _not_ always
the third party code that causes us to bang our heads on our
desks, no, sometimes, it's just some really wacky code that
we wrote a long, long time ago ;-)

> I edit using vim, and use ctags to explore up the
> inheritance chain which is useful enough, but I feel it
> should be quite possible for the editor to search through
> the imports and grab the parent classes to insert into the
> editor view. Any suggestions? Maybe there are better ways
> of navigating inheritance but it does seem logical to
> expose the whole class code in one place, suitably
> annotated. I feel a plugin coming on.

Hey, just be sure to post a link to the repo! ;-)




More information about the Python-list mailing list