Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #54710

Re: python IDE and function definition

Subject Re: python IDE and function definition
From Travis Griggs <travisgriggs@gmail.com>
Date 2013-09-24 09:59 -0700
References <524058FB.20005@mail.usask.ca>
Newsgroups comp.lang.python
Message-ID <mailman.300.1380041976.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Sep 23, 2013, at 8:06 AM, Chris Friesen <cbf123@mail.usask.ca> wrote:

> 
> Hi all,
> 
> I'm looking for a python IDE (for Linux) that can look at code like this:
> 
> class ConductorManager(manager.Manager):
>    def compute_recover(self, context, instance):
>        self.compute_api.stop(context, instance, do_cast=False)
> 
> where I could highlight the "stop" and ask it to go to the definition. (Where the definition is in a different file.)
> 
> I'm running into issues where my current IDE (I'm playing with Komodo) can't seem to locate the definition, I suspect because it's too ambiguous.
> 
> The fact that python is dynamically typed seems to mean that there could potentially be multiple answers, any class with a stop() method with the right signature could presumably be plausible, right?  So rather than give up, I'd like to have my IDE suggest all possible answers.

Hi Chris,

Not sure if this reproduces what you want or not. I use PyCharm (free for free stuff, and very affordable/worthwhile otherwise) on Linux (as well as OSX/Windows). I made a new project, added two files:

provider.py:

class Provider(object):
    def stop(self):
        pass

usage.py:

class Conglomerate(object):
    def doSomething(self):
        self.provision.stop()

I then highlight 'stop', hit Ctrl-B (menu option go to>>declarations) and it brings up all the stop() definitions it could find, the Provider one on the top, click it and I jump there. Ctrl-Alt-B (menu option for goto>>implementation(s)) does nothing… UNLESS… I add this method to Conglomerate:

    def __init__(self):
        super.__init__()
        self.provision = Provider()

Then go to implementations takes me right there to the other file.

HTH

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: python IDE and function definition Travis Griggs <travisgriggs@gmail.com> - 2013-09-24 09:59 -0700

csiph-web