Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52506
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <i.am.songoku@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'importing': 0.05; 'debug': 0.07; 'debugging': 0.07; 'debugging.': 0.09; 'ex:': 0.09; 'kumar': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'def': 0.12; '"python': 0.16; '(pdb)': 0.16; '->': 0.16; 'pdb': 0.16; 'printing.': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'variable': 0.18; 'wed,': 0.18; 'module': 0.19; 'example': 0.22; 'import': 0.22; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'module,': 0.24; 'cc:2**0': 0.24; '>': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'am,': 0.29; 'mode': 0.30; 'statement': 0.30; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; 'option)': 0.31; 'trace': 0.31; "user's": 0.31; 'values.': 0.31; 'option': 0.32; 'run': 0.32; 'url:python': 0.33; 'running': 0.33; 'received:google.com': 0.35; 'there': 0.35; '14,': 0.36; 'url:listinfo': 0.36; 'useful': 0.36; 'url:org': 0.36; 'url:library': 0.38; 'skip:& 20': 0.39; 'called': 0.40; 'url:mail': 0.40; 'commands': 0.60; 'skip:c 50': 0.60; 'hope': 0.61; 'break': 0.61; 'helps': 0.61; 'skip:n 10': 0.64; 'different': 0.65; 'prompt': 0.68; 'below.': 0.71; 'evaluate': 0.72; 'to:addr:yahoo.co.in': 0.91; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=NiMuKeywhVuacKTz08EvWfOseT+AxF27b8QvHTOAfTQ=; b=noyBeEI6f58UOwn7AkN8dBAcfncAwKV0ymKHK1btN6RA5M/tT4BeCBcuzJrUhieMmI xmkynLF5czOR8gaKjSLpD/EIShBB40bU/M9VGT3sBO9NZve0ezfkotJm/a2XDMwy9pkk fGErDSmZnTtL6aF9aueTZBeYyKPDrHsiD+QWpiimQCfGqVkNJ+a4xwgUaRjujtOuHF+V PlZoAu/wmK+T6AkJXOGYa1YLLQd2H3/02UZalU93ufhOpeDtJ6J73YP8wJ+MjqLhhF75 6ta4DJEHidGeqJ8ERNAtDtTpJ6VaGjQUQrwE+HBf+luy/Fw3qkIoc7TA9L9EHMzE4TJX doRQ== |
| MIME-Version | 1.0 |
| X-Received | by 10.180.205.236 with SMTP id lj12mr5599511wic.22.1376479744741; Wed, 14 Aug 2013 04:29:04 -0700 (PDT) |
| In-Reply-To | <1376475131.60391.YahooMailNeo@web190502.mail.sg3.yahoo.com> |
| References | <1376475131.60391.YahooMailNeo@web190502.mail.sg3.yahoo.com> |
| Date | Wed, 14 Aug 2013 04:29:04 -0700 |
| Subject | Re: Verifying Variable value |
| From | Krishnan Shankar <i.am.songoku@gmail.com> |
| To | chandan kumar <chandan_psr@yahoo.co.in> |
| Content-Type | multipart/alternative; boundary=001a11c25f1c39da8104e3e6aa4d |
| Cc | Python <python-list@python.org> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.569.1376479751.1251.python-list@python.org> (permalink) |
| Lines | 125 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1376479751 news.xs4all.nl 15908 [2001:888:2000:d::a6]:46538 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:52506 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Hi Chandan, Python has built-in module called pdb which can be used for debugging. Importing it in the right place will be like setting break point in code and will change the execution to debugging mode. We can use different debugging commands ((n)ext, (c)ontinue, (s)tep etc) to evaluate through the code. Below is the link to module, http://docs.python.org/2/library/pdb.html We can run this code in the following way "python -m pdb filename.py" to run it in pdb debugging mode. Else import pdb and set the trace at right place like below. For example ========= def method() import pdb;pdb.set_trace() <<<---------- import and set_trace() a = 20 b =30 c = a + b method() While running you will get pdb prompt to debug the code line by line. The execution will be in user's hands. Like below, > c:\users\krishnan\desktop\test.py(3)method() -> a = 20 (Pdb) n > c:\users\krishnan\desktop\test.py(4)method() -> b =30 (Pdb) n > c:\users\krishnan\desktop\test.py(5)method() -> c = a + b (Pdb) n --Return-- > c:\users\krishnan\desktop\test.py(5)method()->None -> c = a + b (Pdb) c You can explore the module and find it useful for debugging. I hope this helps Regards, Krishnan On Wed, Aug 14, 2013 at 3:12 AM, chandan kumar <chandan_psr@yahoo.co.in> wrote: Hi , Is there a way to validate variable values while debugging any python code.Run below example in debugging mode and i would like to know the value of c (I know print is an option) with any other option other than printing. In C# or some other tools we can verify each statement and values. Is there way to check each statement in python code like in c#. Ex: def method() a = 20 b =30 c = a + b Best Regards, Chanadn -- http://mail.python.org/mailman/listinfo/python-list
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Verifying Variable value Krishnan Shankar <i.am.songoku@gmail.com> - 2013-08-14 04:29 -0700
csiph-web