Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 868103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:05:11+00:00 2026-05-15T10:05:11+00:00

When studying a snippet of unknown Python code, I occasionally bump into the varName.methodName()

  • 0

When studying a snippet of unknown Python code, I occasionally bump into the

varName.methodName()

pattern.

To figure out what’s this, I shall study the code more, find where varName was instantiated, find its type. So if varName proves to be an instance of ClassName class, I would knew that methodName() is a method of ClassName.

Sometimes varName == self and methodName() is a method of this class, or a method inherited from some other class, if the current class is subclassing some other classes.

Are there quick ways / tools that could take ‘methodName’ as input, scan over all installed Python modules and show which classes have methodName()?

The closest thing related to this I know of is ipython. If I type a class name, then dot (‘.’) then TAB, it can show the class members. Instead of a class I could use a name of an object (which is an instance of a certain class) and it would work too. As soon as I choose a method name from the provided options, I can type ‘?’ or ‘??’ and get some help if there’s a docstring.

I wonder if ipython can do some intelligent scanning based only on ‘methodName’ string.

If you know alternatives to ipython that could possibly help with this, please do suggest them.

Edit: as requested, I’m explicitly adding that I would like a way to find methods by method names not only in Python source code files. Some Python packages (notably PyQt) contain a lot of .so files, and ipython is able to do completions by presumably importing them first. So a plain text search like grep (or even ctags) won’t do the trick here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T10:05:12+00:00Added an answer on May 15, 2026 at 10:05 am

    You want Exuberant ctags (old ctags doesn’t generate tags for Python).

    Once you’ve installed (the way to do that depends on your platform), run it on your files:

    $ /usr/local/bin/ctags *py
    

    (you can run it multiple times to append tags to an existing tag file, have it recurse into subdirectories, etc, all with command-line options) and it makes a tags file like the following (for brevity I’m using a single Python file with one class defining a single method):

    $ cat tags
    !_TAG_FILE_FORMAT   2   /extended format; --format=1 will not append ;" to lines/
    !_TAG_FILE_SORTED   1   /0=unsorted, 1=sorted, 2=foldcase/
    !_TAG_PROGRAM_AUTHOR    Darren Hiebert  /dhiebert@users.sourceforge.net/
    !_TAG_PROGRAM_NAME  Exuberant Ctags //
    !_TAG_PROGRAM_URL   http://ctags.sourceforge.net    /official site/
    !_TAG_PROGRAM_VERSION   5.7 //
    Foo a.py    /^class Foo(object):$/;"    c
    amethod a.py    /^  def amethod(self): pass$/;" m   class:Foo
    

    Now, quoting this article:

    Let say when you discover a function
    call which you wanna see the
    definition, simply point the cursor to
    that function and press ctrl ] and it
    will bring you there. If you want to
    go back to where you came from, simply
    press ctrl t. Instead of ctrl t, I
    like to use ctrl i and ctrl o to
    travel to forward and backward of the
    check points.

    Also, control-P does (some attempt at) code completion for identifiers found in tags.
    (:help tags in vim will give you more details).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was studying the Twitter source code, and I came across the following snippet:
While studying for the SCJP 6 exam, I ran into this question in a
Studying some code from a codeigniter tut, the following preg_match pattern has me baffled:
Im studying some ruby code and I see this varx variable being used with
I was just studying OCPJP questions and I found this strange code: public static
I'm studying this code, and there is a + in the color function which
I'm studying Spree's source code and I came across the snippet. Spree.config do |config|
I was studying ns-3 tutorial . I cannot understand the following code snippet: class
This is a really elementary question. Nonetheless, I haven't found a solution after studying
I was studying an open source code where I came across the following line

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.