Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.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; 'received:209.85.223': 0.03; '<>,': 0.07; 'debug': 0.07; 'debugging': 0.07; 'friend.': 0.07; 'important,': 0.07; 'tests.': 0.07; 'variables': 0.07; 'debugger': 0.09; 'raises': 0.09; 'statements': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; 'suggest': 0.14; '<>.': 0.14; '"i': 0.16; 'advice:': 0.16; 'blindly': 0.16; 'chris,': 0.16; 'fine.': 0.16; 'pdb': 0.16; 'statement.': 0.16; 'thereby': 0.16; 'files.': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'code.': 0.18; 'do.': 0.18; 'variable': 0.18; 'all,': 0.19; 'first.': 0.19; 'slightly': 0.19; 'stack': 0.19; 'things.': 0.19; 'written': 0.21; 'code,': 0.22; 'email addr:gmail.com>': 0.22; 'rules': 0.22; 'tests': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'install': 0.23; 'cc:2**1': 0.23; 'error': 0.23; '31,': 0.24; "shouldn't": 0.24; '>': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'generally': 0.29; 'points': 0.29; 'robert': 0.30; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'asked': 0.31; 'code': 0.31; 'too.': 0.31; 'usually': 0.31; 'assert': 0.31; 'noted': 0.31; 'piece': 0.31; 'yourself.': 0.31; 'figure': 0.32; 'supposed': 0.32; 'interface': 0.32; 'url:python': 0.33; 'bugs': 0.33; 'sense': 0.34; 'could': 0.34; 'problem': 0.35; "can't": 0.35; 'received:209.85': 0.35; 'problem.': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'are,': 0.36; 'coverage': 0.36; 'library.': 0.36; 'url:listinfo': 0.36; 'next': 0.36; 'useful': 0.36; 'url:org': 0.36; 'should': 0.36; 'unit': 0.37; 'turn': 0.37; 'project': 0.37; 'received:209': 0.37; 'step': 0.37; 'problems': 0.38; 'url:amazon': 0.38; 'url:library': 0.38; 'pm,': 0.38; 'explain': 0.39; 'skip:& 20': 0.39; 'flow': 0.39; 'structure': 0.39; 'skip:p 20': 0.39; 'url:mail': 0.40; 'how': 0.40; 'read': 0.60; 'middle': 0.60; 'problems.': 0.60; 'worry': 0.60; 'hardware': 0.61; 'matter': 0.61; 'first': 0.61; 'back': 0.62; 'places': 0.64; 'url:p': 0.64; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'here': 0.66; 'mar': 0.68; 'lose': 0.68; 'wish': 0.70; 'friend,': 0.71; 'yourself': 0.78; '2015': 0.84; 'clearly.': 0.84; 'otten': 0.84; 'sight': 0.84; 'silver': 0.84; 'subject:Project': 0.84; 'colleague,': 0.91; 'url:latest': 0.91; 'wanting': 0.93; 'notebook': 0.96 X-AuditID: 1209190d-f79676d000000da0-00-551b05d86979 X-Received: by 10.107.17.105 with SMTP id z102mr20048112ioi.28.1427834326433; Tue, 31 Mar 2015 13:38:46 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Andrew Farrell Date: Tue, 31 Mar 2015 15:38:16 -0500 Subject: Re: Project, how to debug To: Robert Clove Cc: Peter Otten <__peter__@web.de>, "python-list@python.org" Content-Type: multipart/alternative; boundary=001a113f6c4ed34add05129b958f X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrNKsWRmVeSWpSXmKPExsUixG6nrnuDVTrUYNEWGYsjrddYHRg9Xsx/ wxbAGMVlk5Kak1mWWqRvl8CVcXnva9aCNpeKRV/uMzYwTrTsYuTkkBAwkdj1YhUzhC0mceHe ejYQW0hgMZNEb5NxFyMXkH2OUeLlnyY2COcxk8TSlfdYIZwGRokPTU3sEO2lEh8ezQWzeQUE JU7OfMICMcpTYvLkDWArOAUCJf4cngM1aQujxJszt1hBEmwCGhK3fj5kBLFZBFQlJnz5xgIx KEDi8okjYM3CAkoSN+ZvBrNFgOoX3L0EVsMsECex4nkbK4TtJTH3/FSWCYxCs5DcMQtJahYj B5CtLrF+nhBEWE3i9rar7BC2tsSyha+ZFzCyrmKUTcmt0s1NzMwpTk3WLU5OzMtLLdI10svN LNFLTSndxAgKe05J3h2M7w4qHWIU4GBU4uG9cE8yVIg1say4MvcQoyQHk5Iob8wHqVAhvqT8 lMqMxOKM+KLSnNTiQ4wSHMxKIrzbjwDleFMSK6tSi/JhUtIcLErivJt+8IUICaQnlqRmp6YW pBbBZGU4OJQkeEtYpEOFBItS01Mr0jJzShDSTBycIMN5gIaHgtTwFhck5hZnpkPkTzFacnQc /7WIiWPHzd9Act3VhsVMQix5+XmpUuK8rSANAiANGaV5cDNhaewVozjQi8K8e0GqeIApEG7q K6CFTEALT68SB1lYkoiQkmpg3HDvbefpxm9ycfnXi+7sEYltZyz6MmXbIqlTrsFCm7OknUot Vi2Z1fHRP8/a2fO4f9/kG1dvbzpSMM32xy9ZuzNbvqvce7JsGht3w1KPkL7ys2KsMpPNvNe8 KQo9tORD147ik6+6V3AHdF+6ka51tvC/eWnJjd+r6+ujWe+6Lzz7cimL3pMd7kosxRmJhlrM RcWJAM/KjA0+AwAA X-Mailman-Approved-At: Tue, 31 Mar 2015 23:07:12 +0200 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20 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: 176 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1427836034 news.xs4all.nl 2884 [2001:888:2000:d::a6]:54532 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:88403 --001a113f6c4ed34add05129b958f Content-Type: text/plain; charset=UTF-8 points of general advice: - As noted by Chris, you first need to figure out what the code is *supposed* to do. - Have a notebook and pencil next to you as you are working through this so that you can make notes and draw out the structure of things. - Write down the general structure of the code on your notebook so you always keep yourself oriented. If you find yourself lost, don't just keep reading code; stop and write out what you do understand and try to turn your sense of confusion into concrete questions. - Use The Silver Searcher . If you find yourself thinking "I wish I could just see all the places where the variable 'herring' is used", then `ag -C 5 herring` is going to be your friend. - Use pdb , the python debugger that comes in the standard library. If you find yourself wanting to jump into a section of the code and print out variables and look at stack frames, sticking `import pdb;pdb.set_trace()` in there is going to be your friend. - Actually try using ipdb , which has a slightly better user interface than pdb. But don't worry if you can't install it. pdb is fine. - Much like you shouldn't just blindly read through code, don't just blindly step through code. If you lose sight of where you are, step back and re-orient yourself. - Find a colleague, friend, or rubber duck. Explain to them what you think the code is doing. This will force you to think about things more clearly. - Try writing unit tests for the code with with py.test . It will help you verify "okay, this piece right here is working correctly" and thereby mean that you don't have to check that piece again. - Use assert statements to check that things are as they should be. - Try sticking `assert False` into the middle of a function. If the function raises an error other than AssertionError, then the problem is before the assert statement. - In your spare time, read 9 Indespensible Rules for Debugging Software and Hardware Problems . It is both useful and enjoyable. On Tue, Mar 31, 2015 at 7:05 AM, Robert Clove wrote: > > > On Tue, Mar 31, 2015 at 5:19 PM, Peter Otten <__peter__@web.de> wrote: > >> Robert Clove wrote: >> >> > Hi All, >> > >> > I am facing a problem. >> > I have been given a project written in python and asked to debug it. >> > I have not been given the flow they said understand and debug. >> > >> > Can someone suggest me how to debug it in Wings IDE. >> >> Are those specific bugs that you are supposed to fix or are you to both >> find >> and fix bugs? >> >> > Project have approx 10 files. >> >> Generally speaking speaking this is not so much a matter of tools; if >> there >> is any documentation you can trust reading that is usually the best start; >> reading the code is important, too. >> >> Then you can consider your next steps depending on the "messiness" of the >> code base and the degree of coverage with unit tests. >> >> >> -- >> https://mail.python.org/mailman/listinfo/python-list >> > > > There is no documentation provided i have to read the code understand the > flow first. > > > -- > https://mail.python.org/mailman/listinfo/python-list > > --001a113f6c4ed34add05129b958f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
points of general advice:
- As noted by Chris, you fir= st need to figure out what the code is *supposed* to do.
- Have a n= otebook and pencil next to you as you are working through this so that you = can make notes and draw out the structure of things.
- Write down= the general structure of the code on your notebook so you always keep your= self oriented. If you find yourself lost, don't just keep reading code;= stop and write out what you do understand and try to turn your sense of co= nfusion into concrete questions.
- Use=C2=A0The Silver Searcher.=C2=A0If you fin= d yourself thinking "I wish I could just see all the places where the = variable 'herring' is used", then `ag -C 5 herring` is going t= o be your friend.
- Use pdb, the python debugger that comes in = the standard library. If you find yourself wanting to jump into a section o= f the code and print out variables and look at stack frames, sticking `impo= rt pdb;pdb.set_trace()` in there is going to be your friend.
- Ac= tually try using=C2=A0ipdb, which has a slightly better user interface than pdb. But don&= #39;t worry if you can't install it. pdb is fine.
- Much like= you shouldn't just blindly read through code, don't just blindly s= tep through code. If you lose sight of where you are, step back and re-orie= nt yourself.
- Find a colleague, friend, or rubber duck. Explain = to them what you think the code is doing. This will force you to think abou= t things more clearly.

On Tue, Mar 31, 2015 at 7:05 AM, Robert Clove &l= t;cloverobert@gm= ail.com> wrote:


On Tue, Mar 31, 2015 at 5:19 PM, Peter Otten <__peter__@web.de> wrote:
Robert Clove wrote:
> Hi All,
>
> I am facing a problem.
> I have been given a project written in python and asked to debug it. > I have not been given the flow they said understand and debug.
>
> Can someone suggest me how to debug it in Wings IDE.

Are those specific bugs that you are supposed to fix or are you to b= oth find
and fix bugs?

> Project have approx 10 files.

Generally speaking speaking this is not so much a matter of tools; i= f there
is any documentation you can trust reading that is usually the best start;<= br> reading the code is important, too.

Then you can consider your next steps depending on the "messiness"= ; of the
code base and the degree of coverage with unit tests.


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


There is no documentation provided i have to read the code under= stand the flow first.


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


--001a113f6c4ed34add05129b958f--