Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #74065
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'read.': 0.03; 'third- party': 0.04; 'output': 0.05; 'debugging': 0.07; 'hosts': 0.07; 'installed.': 0.07; 'subject:code': 0.07; 'subject:help': 0.08; 'arguments': 0.09; 'arguments,': 0.09; 'attributes': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'someone,': 0.09; 'statements': 0.09; 'subject:How': 0.10; 'python': 0.11; 'language.': 0.14; '(unlike': 0.16; 'args,': 0.16; 'available)': 0.16; 'class:': 0.16; 'docstring': 0.16; 'docstrings': 0.16; 'emacs,': 0.16; 'emit': 0.16; 'finney': 0.16; 'imo,': 0.16; 'learns': 0.16; 'locally,': 0.16; "module's": 0.16; "object's": 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:when': 0.16; 'terse': 0.16; 'unhelpful': 0.16; 'utterly': 0.16; 'code.': 0.18; 'library': 0.18; 'module': 0.19; 'file,': 0.19; 'written': 0.21; 'shell': 0.22; 'install': 0.23; 'header:User-Agent:1': 0.23; 'exists': 0.24; 'integrate': 0.24; 'module,': 0.24; 'helpful': 0.24; 'environment': 0.24; "i've": 0.25; 'source': 0.25; 'extension': 0.26; 'logging': 0.26; 'least': 0.26; 'header:X-Complaints-To:1': 0.27; 'installed': 0.27; 'function': 0.29; 'feature': 0.29; 'quickly': 0.29; 'thus': 0.29; "doesn't": 0.30; "i'm": 0.30; '(which': 0.31; 'gives': 0.31; 'code': 0.31; 'getting': 0.31; 'easier': 0.31; 'are.': 0.31; 'bunch': 0.31; 'commonly': 0.31; 'informative': 0.31; 'use?': 0.31; 'writes:': 0.31; 'class': 0.32; 'languages': 0.32; 'quite': 0.32; 'call.': 0.33; 'cases': 0.33; 'entirely': 0.33; 'implemented': 0.33; 'common': 0.35; 'editor': 0.35; 'objects': 0.35; 'but': 0.35; 'there': 0.35; 'idle': 0.36; 'keyword': 0.36; 'shows': 0.36; 'similar': 0.36; 'wrong': 0.37; 'too': 0.37; 'two': 0.37; 'ben': 0.38; 'machines': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'stock': 0.39; 'use.': 0.39; 'to:addr:python.org': 0.39; 'unable': 0.39; 'received:org': 0.40; 'how': 0.40; 'even': 0.60; 'skip:u 10': 0.60; 'authority': 0.60; 'most': 0.60; 'new': 0.61; 'browser': 0.61; 'skip:* 10': 0.61; 'information': 0.63; 'valuable': 0.63; 'teaching': 0.64; 'become': 0.64; 'more': 0.64; 'forward': 0.65; 'needing': 0.65; 'skip:\xe2 10': 0.65; 'investment': 0.66; '8bit%:40': 0.68; 'frequently': 0.68; '8bit%:21': 0.69; 'online': 0.71; '8bit%:43': 0.74; 'subject:your': 0.76; '8bit%:46': 0.78; 'glad': 0.83; 'habit.': 0.84; 'high,': 0.84; 'newcomer': 0.84; 'received:125': 0.84; 'subject:you': 0.87; 'browsing': 0.91; 'crucial': 0.91; 'migrating': 0.91; 'mistake': 0.91; 'shell,': 0.91; 'instant': 0.97 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Ben Finney <ben@benfinney.id.au> |
| Subject | Re: How do you use `help` when write your code |
| Date | Mon, 07 Jul 2014 10:53:00 +1000 |
| References | <CAJQX3DwnP24cnhofL2P90V3ux2oz2jT0p2KBDVOaUcWuteijbw@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| X-Gmane-NNTP-Posting-Host | jigong.madmonks.org |
| X-Public-Key-ID | 0xAC128405 |
| X-Public-Key-Fingerprint | 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 |
| X-Public-Key-URL | http://www.benfinney.id.au/contact/bfinney-pubkey.asc |
| X-Post-From | Ben Finney <bignose+hates-spam@benfinney.id.au> |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) |
| Cancel-Lock | sha1:4wZKoyVlizdeTW4KCk+vjpC1qfk= |
| 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.11566.1404694395.18130.python-list@python.org> (permalink) |
| Lines | 80 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1404694395 news.xs4all.nl 2869 [2001:888:2000:d::a6]:58071 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:74065 |
Show key headers only | View raw
Shiyao Ma <i@introo.me> writes: > My normal workflow is use ipython, obj? or obj?? for quick look up or > use docs.python.org for a detailed read. I don't use IPython. I'm glad it exists for those who want it. I frequently use Python on hosts not entirely under my control, where I don't have authority to install new packages, and which only have stock Python installed. So I have to be familiar with IDLE and the standard Python interactive shell. I also find IPython of questionable value when teaching Python to newcomers: its interactive features diverge quite markedly from what is available when writing Python code in a file, so it turns out to be too distracting for someone learning the language. Using the standard Python interactive shell, at least, means what a newcomer learns t the shell is almost entirely transferable to what they need to do to get code into a module's source code. As for the powerful features available in IPython, I find that I get most of them from a Python-aware programmer's editor like Emacs, which also gives me a powerful interactive environment that does more than only Python code. So it would be, IMO, a mistake for me to become too reliant on IPython-specific functionality. It's a high, specific investment that doesn't pay off well on other machines (which commonly don't have it immediately available) or other languages which I need to use. > Do you use `help`? How does it integrate into your workflow? I very often use ‘help(foo)’ at the Python interactive prompt, to get a quick reference to what an object's attributes and features are. There are two common cases where ‘help(foo)’ is unable to help: * If ‘foo’ is a function written without using keyword-only args, but needing to have a bunch of keyword arguments, the signature will often be the uninformative ‘foo(*args, **kwargs)’. A docstring is crucial here, but it's too often wrong or absent. I look forward to more and more functions migrating to use keyword-only arguments for these cases, so the function signature can become much more informative in ‘help’. * If ‘foo’ is a function implemented in an extension (non-Python) module, the signature ‘foo(...)’ is utterly useless. Here, again, the docstring is crucial; and it is frequently just a terse one-liner with no good explanation. Even the standard library is rife with unhelpful function docstrings of this kind. Other than those caveats, I find browsing ‘help(foo)’ output is very helpful in an interactive session, not least for getting information quickly about an unknown object I've generated from some third-party function call. It is a very good feature that ‘help(foo)’ for a class instance shows the help of the class: it can be used indiscriminately, and is thus easier to recommend as a mental habit. > Or instead, what similar tools do you use? I have the ‘python-doc’ and ‘python3-doc’ packages installed locally, and this gives instant access to the whole Python documentation in my browser without any lag or network dependency. The ‘logging’ module is a standard feature and makes it much easier to emit informative debugging statements that (unlike ad-hoc ‘print’ calls) *don't* need to be removed later. Logging can also reveal a lot about the objects while the program is running, as a valuable complement to the ‘help’ feature and online documentation. -- \ “Puritanism: The haunting fear that someone, somewhere, may be | `\ happy.” —Henry L. Mencken | _o__) | Ben Finney
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: How do you use `help` when write your code Ben Finney <ben@benfinney.id.au> - 2014-07-07 10:53 +1000
csiph-web