Discussion:
Social problems of Python doc [was Re: Python docs disappointing]
(too old to reply)
Xah Lee
2009-08-10 03:04:43 UTC
Permalink
The prob with python docs is with the python priests.

there are frequent posts about python doc's poor quality, and some
efforts to improve the doc (such as wiki or seggestions), about few
times a year (in so much as i've seen), the typical response is
pissing fight, with python priests to tell them not to start another
wiki, or “you should apply in our church first and formulate a PEP
proposal first or kindly donate or otherwise fuckoff”, and so on.

i've wrote several articles about this issue, total time spend on this
is probably more than 2 months full-time work. See:

• Python Documentation Problems
http://xahlee.org/perl-python/python_doc_index.html

just about each article above generates a thread of flames.

I also have re-wrote the entire python regex doc in 2005:

• Pyhton Regex Documentation: String Pattern Matching
http://xahlee.org/perl-python/python_re-write/lib/module-re.html

there are some positive reviews, but most are drawn out by nay-sayers.

I often receive thank you emails for 2 particular articles, which are
most frequently google searched as indicated by my weblog:

• Python Doc Problem Example: gzip
http://xahlee.org/perl-python/python_doc_gzip.html

• Python Doc Problem Example: sort()
http://xahlee.org/perl-python/python_doc_sort.html

• Sorting in Python and Perl
http://xahlee.org/perl-python/sort_list.html

See also:

• Language, Purity, Cult, and Deception
http://xahlee.org/UnixResource_dir/writ/lang_purity_cult_deception.html

Xah
∑ http://xahlee.org/


I'm pretty new to Python, and I like a lot overall, but I find the
documentation for Python rather poor, overall.
I'm sure that Python experts don't have this problem: they have
internalized some good ways to access the documentation, are
productive with it, and therefore have lost the ability to see why
the Python documentations is deficient for beginners. This explains
why a suboptimal situation can persist like this: those who are
most able fix it are also the least able to perceive it.
I've heard similar complaints from other experienced programmers
who are trying out Python for the first time: poor documentation.
Here is an *entirely typical* example: on some Unix, try
% pydoc urllib
The displayed documentation mention the optional parameter "data"
in practically every function listed (a few dozen of them). This
parameter is not documented *anywhere* on that page. All that we
are told is that its default value is always None.
I'm sure that I can find a full description of this parameter if
I fire up Google, and search online. In fact, more likely than
not, I'll find far more documentation than I want. But my point
is that a programmer should not need to do this. The full
documentation should be readily accessible directly through a few
keystrokes.
I would love to know how experienced Python programmers quickly
zero in on the Python documentation they need.
TIA!
kynn
Xah Lee
2009-08-17 06:50:27 UTC
Permalink
[Xah Lee]
Post by Xah Lee
i've wrote several articles about this issue, total time spend on this
• Python Documentation Problems
http://xahlee.org/perl-python/python_doc_index.html
I just read you post. You did devote a substantial amount of time
to the project. Some of your criticisms are valid. Wish you had
posted patches, I think many of them would have been accepted.
Since you wrote this a few years ago, many examples have
been added to the docs and more are forthcoming.
Post by Xah Lee
I often receive thank you emails for 2 particular articles, which are
• Python Doc Problem Example: gzip
http://xahlee.org/perl-python/python_doc_gzip.html
• Python Doc Problem Example: sort()
http://xahlee.org/perl-python/python_doc_sort.html
• Sorting in Python and Perl
http://xahlee.org/perl-python/sort_list.html
Some are the criticisms are valid; others seem off-base.
* The key= and reversed= parameters are not intended for special
cases, leaving cmp= for the general case. They were intended to
be full replacements. In Python3.x, the cmp function is gone.
* The interaction of the key= and cmp= functions can be made to
interact (the key function is first applied to every element and
the cmp function then gets applied to the results of the key
function). This isn't a normal or intended use case, so the docs
don't delve into the subject.
* The reversed parameter does more than list.sort() followed by
list.reverse(). It also preserves stability in the event of equal
Post by Xah Lee
sorted([(1,2), (1,3)], key=itemgetter(0), reverse=True)
[(1,2), (1,3)]
li.sort(lambda x, y: cmp(x[1],y[1]), reverse=True)
li.sort(lambda x, y: cmp(y[1],x[1]))
* We should link the sorted() and list.sort() docs to the
sorting how-to (with a fuller discussion on the art of sorting
including a discussion of operator.itemgetter() and
operator.attrgetter() which were designed to work with the key=
parameter.
After one more reading of Xah Lee's posts on the documentation for
sort,
* The reason that list.sort() allows None for the cmp parameter is not
so that you can write list.sort(None). It was put there to make it
easier for people writing function definitions where the cmp function
s = seq[:]
s.sort(cmp) # needs to accept None as a possible
argument
return s[:maxlen]
* The reason for implementing the key= parameter had nothing to do
with limitations of Python's compiler. Instead, it was inspired by
the
decorate-sort-undecorate pattern.
Hi Raymond,

thanks for the many points. They are informative, some i disagree, but
it's getting into detail. I don't know python 3.0, will have to look
into its sort in the future.
* The reason for implementing the key= parameter had nothing to do
with limitations of Python's compiler. Instead, it was inspired by
the
decorate-sort-undecorate pattern.
The decorate-sort-undecorate pattern is a compiler limitation, for
most of today's langs. I'm not sure, but i think some of the fancy
functional langs automatically detect such and optimize it away, to
various degrees.

... my criticism is usually written in a style catered to irritate a
particular class of coder i call tech geekers (they think of themselfs
with their idiotic term “hackers”). So, parts are exaggerated. It'd be
more clear to say, that the reason for python's “key”, and as a
“solution” or need of the decorate-sort-undecorate issue, can be
attributed to the current state of the art of popular imperative
language's compilers (induced by such lang's semantics).

again, i haven't studied python 3.0 to see what it has changed with
sort, and thanks for the informative post. I find it intriguing that
it doesn't have “cmp” anymore as you say.... maybe when i actually
study it and i'll come away with rage and rants. LOL.

Xah
∑ http://xahlee.org/


Jon Harrop
2009-08-17 19:42:38 UTC
Permalink
Post by Xah Lee
* The reason for implementing the key= parameter had nothing to do
with limitations of Python's compiler. Instead, it was inspired by
the
decorate-sort-undecorate pattern.
The decorate-sort-undecorate pattern is a compiler limitation, for
most of today's langs. I'm not sure, but i think some of the fancy
functional langs automatically detect such and optimize it away, to
various degrees.
You mean people use that pattern as a fast alternative in languages where
user-defined functions are very slow, like Python and Mathematica?
--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?u
Nathan Keel
2009-08-17 22:16:56 UTC
Permalink
Post by Jon Harrop
Post by Xah Lee
* The reason for implementing the key= parameter had nothing to do
with limitations of Python's compiler. Instead, it was inspired by
the
decorate-sort-undecorate pattern.
The decorate-sort-undecorate pattern is a compiler limitation, for
most of today's langs. I'm not sure, but i think some of the fancy
functional langs automatically detect such and optimize it away, to
various degrees.
You mean people use that pattern as a fast alternative in languages
where user-defined functions are very slow, like Python and
Mathematica?
Do not give this "Xah Lee" idiot any attention. This asshole posts only
self-serving nonsense, because he thinks it makes him sound important
(when in reality, he is absolutely clueless). This idiot always cross
posts to 5 or more different groups that have nothing to do with his
attempts to impress people (which always fail). He's incredibly
arrogant, yet incredibly clueless.

Continue reading on narkive:
Search results for 'Social problems of Python doc [was Re: Python docs disappointing]' (Questions and Answers)
26
replies
can someone send me a really really really long answer???
started 2007-01-16 03:24:45 UTC
singles & dating
Loading...