[issue32283] Cmd.onecmd documentation is misleading

2017-12-11 Thread Kevin Lyda

New submission from Kevin Lyda <ke...@ie.suberic.net>:

The documentation for Cmd.onecmd is misleading. It says that "This may be 
overridden, but should not normally need to be; see the precmd() and postcmd() 
methods for useful execution hooks."

https://github.com/python/cpython/blob/v3.7.0a3/Lib/cmd.py#L193

However a common idiom is to call onecmd directly to process commands coming 
from sys.argv. This shows up in the Cmd entries the Python MOTW site for 
instance.

https://pymotw.com/3/cmd/#commands-from-sys-argv

>From the docs you might think that precmd and postcmd are called when you call 
>onecmd directly this way. However this is not true - they are only called in 
>the cmdloop method.

https://github.com/python/cpython/blob/v3.7.0a3/Lib/cmd.py#L137

Moving the precmd and postcmd methods into onecmd would make the onecmd docs 
make more sense. Then they could be used in lieu of overriding onecmd for all 
uses of onecmd - inside of cmdloop and on its own. But loads of code depends on 
current behaviour.

So instead something in the docs to indicate that those hooks only work when 
onecmd is called inside cmdloop would be good. Perhaps like so:

"""Interpret the argument as though it had been typed in response
to the prompt.

This may be overridden, but should not normally need to be;
see the precmd() and postcmd() methods for useful execution hooks
when onecmd() is called from cmdloop(). When onecmd() is called
directly, make sure to call precmd() and postcmd() yourself.
The return value is a flag indicating whether interpretation of
commands by the interpreter should stop.

"""

--
components: Library (Lib)
messages: 308082
nosy: lyda
priority: normal
severity: normal
status: open
title: Cmd.onecmd documentation is misleading
versions: Python 3.6, Python 3.7

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32283>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17281] Broken links at pypi

2013-02-23 Thread Kevin Lyda

New submission from Kevin Lyda:

The pypi entry for distutils2 has a comical set of broken links (docs and 
contributing): https://pypi.python.org/pypi/Distutils2

The following two paragraphs have broken links. Adding a link checker to your 
browser isn't the worst idea.

The Distutils2 codebase is a fork of Distutils. It is not backward compatible 
with Distutils and does not depend on it. It provides more features and 
implements new packaging standards. In Python 3.3, Distutils2 is included in 
the standard library under the module name packaging. Documentation is 
provided at http://docs.python.org/dev/packaging 404 --for ease of maintenance, 
it is not duplicated in this repository. You can use the Packaging 
documentation to use Distutils2; only the package name is different (packaging 
vs. distutils2), all modules, classes and functions have the same name.

If you want to contribute, please have a look at DEVNOTES.txt or 
http://wiki.python.org/Distutils2/Contributing 404 .

--
assignee: eric.araujo
components: Distutils2
messages: 182747
nosy: alexis, eric.araujo, lyda, tarek
priority: normal
severity: normal
status: open
title: Broken links at pypi
type: behavior
versions: 3rd party, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 
3.3, Python 3.4, Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17281
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com