Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'patterns.': 0.07; 'occurrences': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'windows,': 0.09; 'runs': 0.10; 'jan': 0.12; '(within': 0.16; 'classes)': 0.16; 'grep': 0.16; 'hits': 0.16; 'menu.': 0.16; "package's": 0.16; 'program?': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:class': 0.16; 'subject:where': 0.16; 'tracing': 0.16; 'wrote:': 0.18; "python's": 0.19; 'header:User-Agent:1': 0.23; 'module,': 0.24; 'text,': 0.24; 'unicode': 0.24; 'source': 0.25; 'skip:" 20': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'announcement': 0.30; 'forgot': 0.30; 'gives': 0.31; '(on': 0.31; 'default,': 0.31; 'multiline': 0.31; 'name;': 0.31; 'searches': 0.31; 'writes:': 0.31; 'allows': 0.31; 'file': 0.32; 'class': 0.32; 'another': 0.32; 'text': 0.33; '(e.g.': 0.33; 'limitation': 0.33; 'tool': 0.35; 'objects': 0.35; 'one,': 0.35; 'there': 0.35; 'idle': 0.36; 'reports': 0.37; 'throughout': 0.37; 'operating': 0.37; 'to:addr:python-list': 0.38; 'files': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'called': 0.40; 'numbers': 0.61; 'received:173': 0.61; 'simple': 0.61; 'name': 0.63; 'such': 0.63; 'face': 0.64; 'results': 0.69; 'containing': 0.69; 'maybe,': 0.84; 'received:fios.verizon.net': 0.84; 'selection,': 0.84; 'same,': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Find out where a class is used throughout a program. Date: Wed, 04 Sep 2013 17:36:47 -0400 References: <9d290db6-b9cb-41af-8107-e7f27d2da6d0@googlegroups.com> <8761ugl591.fsf@handshake.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-251-66.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 In-Reply-To: <8761ugl591.fsf@handshake.de> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1378330621 news.xs4all.nl 15952 [2001:888:2000:d::a6]:59203 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:53654 On 9/4/2013 4:08 PM, dieter wrote: > Azureaus 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