Re: python IDE and function definition

2013-09-26 Thread Ben Finney
Chris Friesen cbf...@mail.usask.ca writes:

 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 feature you're looking for – to start from the statement where a
function is called, then jump to the statement where that function is
defined – is implemented via “tags” across many languages and tools.

One very popular implementation is “Exuberant Ctags”. You can choose
from the tools URL:http://ctags.sourceforge.net/tools.html that
support that system, and continue using the same system when you switch
to a different language or a different tool.

 So rather than give up, I'd like to have my IDE suggest all possible
 answers.

Good luck to you in learning a development environment that is *not*
tied to the particular programming language you're writing.

-- 
 \  “… a Microsoft Certified System Engineer is to information |
  `\ technology as a McDonalds Certified Food Specialist is to the |
_o__)   culinary arts.” —Michael Bacarella |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python IDE and function definition

2013-09-24 Thread Fabio Zadrozny
On Mon, Sep 23, 2013 at 8:20 PM, Neil Hodgson nhodg...@iinet.net.au wrote:

 Chris Friesen:


  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.


 Some IDEs allow you to help them understand the context by adding type
 information. Here's some documentation for Wing IDE that uses an isinstance
 assertion:
 http://www.wingware.com/doc/**edit/helping-wing-analyze-codehttp://www.wingware.com/doc/edit/helping-wing-analyze-code


Just to note, PyDev can also use the assert isinstance as well as
docstrings (http://pydev.org/manual_adv_type_hints.html) for type hinting.

Cheers,

Fabio
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python IDE and function definition

2013-09-24 Thread Travis Griggs

On Sep 23, 2013, at 8:06 AM, Chris Friesen cbf...@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 todeclarations) 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 
gotoimplementation(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
-- 
https://mail.python.org/mailman/listinfo/python-list


python IDE and function definition

2013-09-23 Thread Chris Friesen


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.


Chris
--
https://mail.python.org/mailman/listinfo/python-list


Re: python IDE and function definition

2013-09-23 Thread Fabio Zadrozny
On Mon, Sep 23, 2013 at 12:06 PM, Chris Friesen cbf...@mail.usask.cawrote:


 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.



PyDev (http://pydev.org/) is able to do that (i.e.: if the find definition
doesn't find it directly, it shows a list with possible matches for you to
choose the most appropriate one: http://pydev.org/manual_adv_gotodef.html)
-- additionally, you can also search for methods/classes/attributes
directly: http://pydev.org/manual_adv_open_decl_quick.html

Cheers,

Fabio





 Chris
 --
 https://mail.python.org/**mailman/listinfo/python-listhttps://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python IDE and function definition

2013-09-23 Thread Fabio Zadrozny
On Mon, Sep 23, 2013 at 2:29 PM, Chris Friesen cbf...@mail.usask.ca wrote:

 On 09/23/2013 09:32 AM, Fabio Zadrozny wrote:

 On Mon, Sep 23, 2013 at 12:06 PM, Chris Friesen cbf...@mail.usask.ca
 mailto:cbf...@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.



 PyDev (http://pydev.org/) is able to do that (i.e.: if the find
 definition doesn't find it directly, it shows a list with possible
 matches for you to choose the most appropriate one:
 http://pydev.org/manual_adv_**gotodef.htmlhttp://pydev.org/manual_adv_gotodef.html)
 -- additionally, you can also
 search for methods/classes/attributes directly:
 http://pydev.org/manual_adv_**open_decl_quick.htmlhttp://pydev.org/manual_adv_open_decl_quick.html


 I've installed eclipse/pydev and tried it out.  The problem that I'm
 seeing is that it will show me *all* stop() methods that it knows about,
 regardless of function signature.

 So in the above case, my function call looks like:
 self.compute_api.stop(context, instance, do_cast=False)

 but pydev will offer matches that look like:
 def stop(self):

 This runs into problems with commonly-named functions.  I tried searching
 for the start() method in:

 self.compute_api.start(**context, instance)

 and it complained that there were too many possible results.

 Basically, I'm looking for something smart enough to throw out methods
 with the same name but that don't match the signature.

 Chris


Seems like a nice request... it'd be nice if you can report it as a feature
request at the pydev tracker (at https://sw-brainwy.rhcloud.com/ -- note
that you have to sign up to create an issue).

Cheers,

Fabio
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python IDE and function definition

2013-09-23 Thread Chris Friesen

On 09/23/2013 09:32 AM, Fabio Zadrozny wrote:

On Mon, Sep 23, 2013 at 12:06 PM, Chris Friesen cbf...@mail.usask.ca
mailto:cbf...@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.



PyDev (http://pydev.org/) is able to do that (i.e.: if the find
definition doesn't find it directly, it shows a list with possible
matches for you to choose the most appropriate one:
http://pydev.org/manual_adv_gotodef.html) -- additionally, you can also
search for methods/classes/attributes directly:
http://pydev.org/manual_adv_open_decl_quick.html


I've installed eclipse/pydev and tried it out.  The problem that I'm 
seeing is that it will show me *all* stop() methods that it knows about, 
regardless of function signature.


So in the above case, my function call looks like:
self.compute_api.stop(context, instance, do_cast=False)

but pydev will offer matches that look like:
def stop(self):

This runs into problems with commonly-named functions.  I tried 
searching for the start() method in:


self.compute_api.start(context, instance)

and it complained that there were too many possible results.

Basically, I'm looking for something smart enough to throw out methods 
with the same name but that don't match the signature.


Chris

--
https://mail.python.org/mailman/listinfo/python-list


Re: python IDE and function definition

2013-09-23 Thread Neil Hodgson

Chris Friesen:


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.


Some IDEs allow you to help them understand the context by adding 
type information. Here's some documentation for Wing IDE that uses an 
isinstance assertion:

http://www.wingware.com/doc/edit/helping-wing-analyze-code

   Neil
--
https://mail.python.org/mailman/listinfo/python-list