classification
Title: Doc files deleted from repo are not deleted from docs.python.org.
Type: Stage:
Components: Documentation Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: audreyr, brandon-rhodes, docs@python, r.david.murray, steven.daprano
Priority: normal Keywords:

Created on 2014-07-11 13:07 by brandon-rhodes, last changed 2019-04-26 19:16 by BreamoreBoy.

Messages (9)
msg222741 - (view) Author: Brandon Rhodes (brandon-rhodes) * Date: 2014-07-11 13:07
There was an old document in the "howto" folder whose advice was in many cases flat-out wrong, so Raymond Hettinger performed a wonderful public service by deleting it back in 2011:

http://hg.python.org/cpython/rev/80ff78425419

Unfortunately it looks like the process for publishing Python documentation only adds documents, but never deletes them, so a copy of the documentation is still available under the "3.4" document tree:

https://docs.python.org/3.4/howto/doanddont.html

It should be deleted as soon as possible. Because it is presumed that only the most accurate and up-to-date documentation lives under the URL "3.4", people are reading and debating this document's bad advice as though it is official guidance as to how to use the language. (The only hint that something is wrong, alas, is the tiny detail that the top-left of the page says “Python v3.3a0 documentation”).

The advice is currently being debated on Twitter and people are sad that they are supposed to stop using “from foo import bar” in Python.
msg222755 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2014-07-11 15:03
> in many cases flat-out wrong

What advice is "flat-out wrong"? All the advice seems excellent to me:

* avoid "from spam import *" (with a very few exceptions)
* be cautious about "from spam import eggs"
* avoid bare "except" clauses
* watch out for "time from check to time to use" race conditions
  (e.g. prefer EAFP over LBYL when opening files)
* don't reinvent the wheel poorly when the std lib already solves
  your problem
* avoid backslash as line continuation


> It should be deleted as soon as possible.

Why delete it rather than fix any (alleged) problems with it?


> The advice is currently being debated on Twitter and people 
> are sad that they are supposed to stop using “from foo import bar”

Debated on Twitter. Why am I not surprised that they've misunderstood it?

The document explains why "from foo import bar" can *sometimes* be harmful. The wording could be improved, and isn't as clear as it should be, but the advice is broadly correct: "from foo import bar" injects the object bar into the current namespace, not the name, which means that if foo rebinds bar, that change will not be seen in the current namespace. If foo never rebinds bar, then there is no problem, but if bar is a *variable* rather than a (pseudo-)constant, you may run into subtle and tricky problems.

-1 on deleting.

If the consensus is to keep it, I'll look at rewording and improving some of the weaker descriptions.
msg222758 - (view) Author: Brandon Rhodes (brandon-rhodes) * Date: 2014-07-11 15:16
The question of whether the document ought to be removed is not at issue here. The document was already deleted, in 2011, by Raymond Hettinger, with the consent of its author. I told that story merely as background.

The issue here is that the Python web site is out of date with the documentation in the Mercurial source repository, which is clear because what is clearly marked as an old 3.3-alpha document is being served out of the /3.4/ directory. This is probably because the documentation “push” script does not remove documents from the site, and can be corrected through a simple "rm" by anyone with access to the server.
msg222759 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-07-11 15:21
The file no longer exists in the 3.5 tree on the server.  Since it isn't linked from the 3.4 index, it may be more effort than it is worth to get someone to delete the file from the 3.4 tree on the server.  On the other hand, fixing the publication process to delete files is something the doc team should probably tackle (note: it might be a sphinx issue, but as Brandon says is more likely an issue with the script that publishes the pages to the server).

As for revising the howto and re-adding it, that is a separate issue and should be discussed on the original issue 7391, where the possibility was already raised and got some support.
msg222770 - (view) Author: Audrey Roy (audreyr) Date: 2014-07-11 17:48
> Since it isn't linked from the 3.4 index, it may be more effort than 
> it is worth to get someone to delete the file from the 3.4 tree on the
> server.

It would be worthwhile to delete or fix it in the 2.7 and 3.4 tree.

It accidentally gets linked, still causing confusion to 2.7 and 3.4 users:
https://twitter.com/audreyr/status/487446878837944320
msg222778 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-07-11 19:05
The docs state 'from module import name1, name2. - This is a “don’t” which is much weaker than the previous “don’t”s but is still something you should not do if you don’t have good reasons to do that.'  How does that translate into 'The Python docs say that "from module import name1, name2" is an anti-idiom' ?
msg222787 - (view) Author: Audrey Roy (audreyr) Date: 2014-07-11 19:58
Mark, I and a number of others simply misinterpreted the text in that section.
msg222790 - (view) Author: Brandon Rhodes (brandon-rhodes) * Date: 2014-07-11 20:11
I do not find it unreasonable, on a page of Python idioms, the we would call an example that explicitly says "Don't" in its title an "anti-idiom."
msg223043 - (view) Author: Brandon Rhodes (brandon-rhodes) * Date: 2014-07-14 17:21
Now that I am back at a full keyboard, I see that my previous response
to @BreamoreBoy about this issue is too short and too cryptic to really
serve as a fair answer to his question.  And, with some embarrassment, I
note that my words did not even achieve the dignity of forming an actual
English sentence.  Alas for cramped travel laptop keyboards and airport
wi-fi!

Might I be allowed another try?  If so, then: @BreamoreBoy, I think that
your confusion ("How does that translate?") can be blamed squarely on
the document in question.  Instead of introducing and maintaining a
consistent terminology, it manages to burden the reader with two
parallel and redundant sets of terms for exactly the same idea.

In short, the document title does not match the document itself.

The title of the document sets forth the terms "Idiom" and "Anti-idiom"
as its subject.  But then it completely drops the ball.  The terms are
not defined in the document itself.  They are not clarified anywhere in
its text.  Nor are they even *used* anywhere in its body, with a single
lonely exception buried down somewhere around the middle (second
paragraph under "Exceptions").

Instead, the body uses the simpler phrases "Do", "do not", and "should
not."  It is running in its "do not" / "don't" mode when it reaches the
sentence you quote, Mark, about "from...import" statements.

So the answer to your "How does that translate" question is that what
the title promises as "Idioms" and "Anti-idioms" actually come out
verbally in the text as "do" and "don't" instead.  When someone jumps
into the middle of the document without context, they see only "do" or
"don't" and are left wondering where the terminology of "idioms" is even
coming from.  But it comes directly from the title, as the only possible
mapping between the document's terms and those of its title.

So when the document says:

    from module import name1, name2. - This is a "don’t"...

the careful reader who has noticed and remembered the title will
simultaneously read:

    from module import name1, name2. - This is an anti-idiom...

Which is almost exactly the text of Audrey's tweet.
History
Date User Action Args
2019-04-26 19:16:26BreamoreBoysetnosy: - BreamoreBoy
2014-07-14 17:21:41brandon-rhodessetmessages: + msg223043
2014-07-11 20:11:16brandon-rhodessetmessages: + msg222790
2014-07-11 19:58:31audreyrsetmessages: + msg222787
2014-07-11 19:05:33BreamoreBoysetnosy: + BreamoreBoy
messages: + msg222778
2014-07-11 17:48:17audreyrsetnosy: + audreyr
messages: + msg222770
2014-07-11 15:21:13r.david.murraysetnosy: + r.david.murray
title: Deleted document should not appear in 3.4 docs -> Doc files deleted from repo are not deleted from docs.python.org.
messages: + msg222759

versions: + Python 2.7, Python 3.5
2014-07-11 15:16:38brandon-rhodessetmessages: + msg222758
2014-07-11 15:03:17steven.dapranosetnosy: + steven.daprano
messages: + msg222755
2014-07-11 13:07:43brandon-rhodessetassignee: docs@python

nosy: + docs@python
components: + Documentation
versions: + Python 3.4
2014-07-11 13:07:11brandon-rhodescreate