[issue22571] Remove import * recommendations and examples in doc?
Raymond Hettinger
report at bugs.python.org
Sun Oct 12 09:19:47 CEST 2014
Raymond Hettinger added the comment:
Many of these (such as collections, collections.abc, decimal, and itertools) use import * as part of the doctest setup and are not part of the generated page shown to users.
Also, I don't think you should be aggressive about removing the other example that are visible users. The "import *" construct is part of the language and will be encountered occasionally.
For similar reasons, the decimal module was specifically designed for be easily usable with "import *" because of the numerous exceptions and rounding flags and constants.
There are also some examples such the one in cmd.rst that I put there on-purpose. Changing it would distract from the focus of the example.
With respect to Tkinter (and other gui toolkits as well), I believe that "import *" is a standard or common practice, in part because there are so many widget names names and widget options. Changing the example might make it more pep8-ish but would result in a good deal of clutter that isn't the normal practice.
> Should we finish the job? Or leave the issue to
> individual chapter authors?
I vote for leaving any changes to the chapter authors who are in a better position to know that they were trying to communicate or who were just setting up the doctests. As discussed above some of the import * are there for a reason.
We really need to start thinking of PEP 8 as something we do to our own code rather than something that gets inflicted on other people's code.
----------
assignee: docs at python -> rhettinger
nosy: +rhettinger
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22571>
_______________________________________
More information about the Python-bugs-list
mailing list