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


Groups > comp.lang.python > #53654

Re: Find out where a class is used throughout a program.

From Terry Reedy <tjreedy@udel.edu>
Subject Re: Find out where a class is used throughout a program.
Date 2013-09-04 17:36 -0400
References <9d290db6-b9cb-41af-8107-e7f27d2da6d0@googlegroups.com> <8761ugl591.fsf@handshake.de>
Newsgroups comp.lang.python
Message-ID <mailman.64.1378330621.5461.python-list@python.org> (permalink)

Show all headers | View raw


On 9/4/2013 4:08 PM, dieter wrote:
> Azureaus <lo0446@my.bristol.ac.uk> writes:
>> ...
>> is there a way of finding out / visualising where a particular class is called/used throughout a program?

> I do not know a simple and reliable way.
>
> When I face such a situation, I use standard operating system
> utilities (e.g. "grep -r" under *nix) to search for occurrences of
> the class name in the source tree. This often gives good
> results when the class name has been well chosen.

Idle has a built-in 'grep' called 'Find in Files' on the Edit menu. I 
use it routinely. By default, it searches for the current text 
selection, if there is one, in all files in the directory containing the 
current file (and subdirectories). Idle's grep uses Python's re module, 
so one does not have to learn another re dialect. So it works the same, 
with Unicode text, on all systems, including Windows, which does not 
come with grep. The (undocumented) limitation is that it searches each 
line separately, so it cannot search for multiline patterns. (I would 
not be surprised if grep does that same, as it also reports line numbers 
and multiple hits in a file.)

> Recently (within the last 2 months), I have seen the announcement
> (on "...python.announce") of a tracing tool (I forgot the package's
> name; maybe, it has been "CodeInspector"). When I have understood
> the announcement correctly, then it traces concrete runs
> and allows you to explore where objects (e.g. classes) have
> been used *in these runs*.


-- 
Terry Jan Reedy

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


Thread

Find out where a class is used throughout a program. Azureaus <lo0446@my.bristol.ac.uk> - 2013-09-04 09:32 -0700
  Re: Find out where a class is used throughout a program. dieter <dieter@handshake.de> - 2013-09-04 22:08 +0200
    Re: Find out where a class is used throughout a program. Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2013-09-04 22:40 +0200
  Re: Find out where a class is used throughout a program. Terry Reedy <tjreedy@udel.edu> - 2013-09-04 17:36 -0400
  Re: Find out where a class is used throughout a program. alex23 <wuwei23@gmail.com> - 2013-09-05 10:11 +1000
  Re: Find out where a class is used throughout a program. Roy Smith <roy@panix.com> - 2013-09-04 21:48 -0400
  Re: Find out where a class is used throughout a program. Steven D'Aprano <steve@pearwood.info> - 2013-09-05 02:16 +0000
  Re: Find out where a class is used throughout a program. Dave Angel <davea@davea.name> - 2013-09-05 09:08 +0000
  Re: Find out where a class is used throughout a program. Azureaus <lo0446@my.bristol.ac.uk> - 2013-09-05 05:42 -0700
    Re: Find out where a class is used throughout a program. Chris Angelico <rosuav@gmail.com> - 2013-09-05 22:53 +1000

csiph-web