Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #74062
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'configure': 0.05; 'interpreter': 0.05; 'output': 0.05; 'root': 0.05; 'debug': 0.07; 'debugging': 0.07; 'subject:code': 0.07; 'subject:help': 0.08; 'bug.': 0.09; 'except:': 0.09; 'lawrence': 0.09; 'mess': 0.09; 'pretend': 0.09; 'statements': 0.09; 'style.': 0.09; 'useless': 0.09; 'vast': 0.09; 'subject:How': 0.10; 'api': 0.11; 'cc:addr :python-list': 0.11; 'python': 0.11; 'bug': 0.12; '*real*': 0.16; 'command.': 0.16; 'correlation': 0.16; 'debugging:': 0.16; 'finds': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'it".': 0.16; 'log.': 0.16; 'roy': 0.16; 'subject:when': 0.16; 'wrote:': 0.18; 'do.': 0.18; 'module': 0.19; "python's": 0.19; 'saying': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'possess': 0.24; 'helpful': 0.24; 'mon,': 0.24; 'environment': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'source': 0.25; 'handling': 0.26; 'logging': 0.26; 'skip:" 20': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; "doesn't": 0.30; 'ease': 0.30; 'message-id:@mail.gmail.com': 0.30; 'gives': 0.31; 'went': 0.31; 'code': 0.31; 'easier': 0.31; 'url:wiki': 0.31; '(maybe': 0.31; '(perhaps': 0.31; 'fighting': 0.31; 'another': 0.32; 'running': 0.33; 'becomes': 0.33; 'bugs': 0.33; 'programmers': 0.33; 'maybe': 0.34; 'problem': 0.35; "can't": 0.35; 'something': 0.35; 'johnson': 0.35; 'point.': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'version': 0.36; 'really': 0.36; 'done': 0.36; "didn't": 0.36; 'application': 0.37; 'performance': 0.37; 'sometimes': 0.38; 'problems': 0.38; 'configured': 0.38; 'tools,': 0.38; 'that,': 0.38; 'how': 0.40; 'around.': 0.60; 'failures': 0.60; 'tell': 0.60; 'black': 0.61; 'full': 0.61; 'matter': 0.61; "you're": 0.61; 'times': 0.62; 'real': 0.63; 'box,': 0.64; 'more': 0.64; 'direct': 0.67; 'between': 0.67; '21st': 0.68; 'smith': 0.68; 'surrounding': 0.68; 'jul': 0.74; 'hey,': 0.75; 'subject:your': 0.76; 'article': 0.77; 'yourself': 0.78; '"real': 0.84; '5:15': 0.84; 'beside': 0.84; 'century': 0.84; 'disappears': 0.84; 'father': 0.84; 'subject:you': 0.87; 'browsing': 0.91; 'to:none': 0.92; 'imagine': 0.93; 'insane': 0.93; 'rick': 0.93 |
| 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:cc :content-type; bh=SxT+2qabemU3f3aHuTJDjZoaRpqZvTbrIsiu0xG25mQ=; b=KBD8dZGJFP0kt0uDCMp9y1QFpWAzCsptYYk/pAQDlucZbW0ab6M1Jy99YVaPm9Jfq7 pV/7vtSCiQ9OhCnX5gfXgsS6C+Dd98dpHmX+rn2CkSnmbgBKYra2+VwItwS3TXlnKmrj Rza+vk+3mK2CJShu2KY5AIuPSHmGj0za6bp3G3Mte+NEdAwmOxuX280z+Zt5V2JNlsuw QNJsoetioK8IfYPTkXGdxwAUicCcAyoenGZwOTgUhWZgL3lhHbaiKdRITHKJVo8ZN2xR C2BnaVFchP0LjCLLKcPERX5yTy+OK2Sfz/El9EmIE2xg5pMyZxKj4+ceQJRA4Pu1LVXn 0+Vg== |
| MIME-Version | 1.0 |
| X-Received | by 10.221.26.10 with SMTP id rk10mr24092921vcb.0.1404687283384; Sun, 06 Jul 2014 15:54:43 -0700 (PDT) |
| In-Reply-To | <roy-CE5D08.15151006072014@news.panix.com> |
| References | <mailman.11547.1404665036.18130.python-list@python.org> <f2559e87-6100-4e1d-9cc6-90aebe6133d1@googlegroups.com> <mailman.11552.1404673207.18130.python-list@python.org> <roy-CE5D08.15151006072014@news.panix.com> |
| Date | Mon, 7 Jul 2014 08:54:43 +1000 |
| Subject | Re: How do you use `help` when write your code |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| 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 | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.11564.1404687291.18130.python-list@python.org> (permalink) |
| Lines | 54 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1404687291 news.xs4all.nl 2971 [2001:888:2000:d::a6]:35171 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:74062 |
Show key headers only | View raw
On Mon, Jul 7, 2014 at 5:15 AM, Roy Smith <roy@panix.com> wrote:
> In article <mailman.11552.1404673207.18130.python-list@python.org>,
> Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
>
>> On 06/07/2014 19:48, Rick Johnson wrote:
>> >
>> > *Real* programmers possess keen detective that can root out
>> > bugs with nothing more than a few well placed print
>> > statements and some good old fashioned "eyeball analysis".
>> >
>>
>> In the 21st century real programmers are using the logging module so
>> they don't have to mess around.
>
> The problem with the logging module is you can configure it to do pretty
> much anything, which is another way of saying if it's not configured
> right (perhaps because you're running your application in an environment
> it wasn't designed for), your output disappears into the ether.
>
> I can't tell you how many times I've given up fighting with logging and
> just done "open("/tmp/x").write("my debugging message\n") when all else
> failed.
But the important thing is that you log. There's a VAST difference
between logging and interactive debugging: logging can debug something
that happened once and didn't recur, interactive debugging requires
that you create the problem on command. Have you ever had a bug where
someone else finds it and then doesn't give you full repro steps? Or
where you find it yourself and declare it intermittent? Proper logging
(and hey, Python's pretty helpful with exceptions) can mean that you
find that just by browsing backward.
There are times when you have to go for the "Real Programmer"
debugging style. Pretend the program is a black box, no source code
available, nothing. (Maybe that's because it really is like that, or
maybe it's just easier to strace a process and watch for the failures
than it is to hunt down the source code for the exact version you're
running.) Or pretend the code has no direct correlation to what
happens, owing to an interpreter bug. (Again, it really can be;
imagine a refcount bug in a Python C API function.) Debugging those
problems gives you an appreciation for the ease of "double-click the
line in the traceback, or hit F4, and go straight to the cause of the
error". Python gives us an insane amount of help (I say "insane"
because sometimes there have been performance questions surrounding
tracebacks), although at the end of the day, debugging is something
people. not tools, do. No matter how good Python's traceback handling
is, it becomes useless if you wrap everything in "try: ... except:
print('Something went wrong')". As Alice's father told her, a tool's
"intended function is almost beside the point. Ultimately it's only as
good as the person who wields it".
http://alice.wikia.com/wiki/Memory
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How do you use `help` when write your code Shiyao Ma <i@introo.me> - 2014-07-07 00:36 +0800
Re: How do you use `help` when write your code Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-07-06 17:52 +0000
Re: How do you use `help` when write your code Tim Chase <python.list@tim.thechases.com> - 2014-07-06 13:22 -0500
Re: How do you use `help` when write your code Roy Smith <roy@panix.com> - 2014-07-06 14:48 -0400
Re: How do you use `help` when write your code Rick Johnson <rantingrickjohnson@gmail.com> - 2014-07-06 11:48 -0700
Re: How do you use `help` when write your code Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-07-06 19:58 +0100
Re: How do you use `help` when write your code Roy Smith <roy@panix.com> - 2014-07-06 15:15 -0400
Re: How do you use `help` when write your code Chris Angelico <rosuav@gmail.com> - 2014-07-07 08:54 +1000
Re: How do you use `help` when write your code Roy Smith <roy@panix.com> - 2014-07-06 20:52 -0400
Re: How do you use `help` when write your code Chris Angelico <rosuav@gmail.com> - 2014-07-07 13:06 +1000
Re: How do you use `help` when write your code Roy Smith <roy@panix.com> - 2014-07-07 07:22 -0400
Re: How do you use `help` when write your code Chris Angelico <rosuav@gmail.com> - 2014-07-07 21:36 +1000
Re: How do you use `help` when write your code Cameron Simpson <cs@zip.com.au> - 2014-07-07 11:51 +1000
csiph-web