[issue27601] Minor inaccuracy in hash documentation
New submission from Aleksandr Koshkin: https://docs.python.org/3.6/library/stdtypes.html#hashing-of-numeric-types Look at semantics example for hash_complex function. The variable 'hash' is clearly misused - it is not defined or refers to builtin function 'hash'. Either way the example is incorrect. ---------- assignee: docs@python components: Documentation messages: 271097 nosy: docs@python, magniff priority: normal severity: normal status: open title: Minor inaccuracy in hash documentation versions: Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27601> _______________________________________
Aleksandr Koshkin added the comment: Moreover this example contains following code if hash_ == -1: hash_ == -2 return hash_ that doesn`t make too much sense. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27601> _______________________________________
Emanuel Barry added the comment: Indeed, nicely spotted! Patch attached (hash_complex_type_1.patch) P.S.: I don't like the 'hash_' name as a variable for this example; it looks like grit on Tim's monitor to me, so I went ahead and renamed it to 'hash_value' in that block. Attached as a separate patch for good measure (hash_doc_renamed_1.patch) ---------- keywords: +patch nosy: +ebarry stage: -> patch review versions: -Python 3.2, Python 3.3, Python 3.4, Python 3.5 Added file: http://bugs.python.org/file43845/hash_complex_typo_1.patch _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27601> _______________________________________
Changes by Emanuel Barry <barry@dadadata.net>: Added file: http://bugs.python.org/file43846/hash_doc_renamed_1.patch _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27601> _______________________________________
Aleksandr Koshkin added the comment: Thanks) ---------- resolution: -> fixed versions: +Python 3.2, Python 3.3, Python 3.4, Python 3.5 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27601> _______________________________________
Changes by Aleksandr Koshkin <tinysnippets@gmail.com>: ---------- status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27601> _______________________________________
Changes by Raymond Hettinger <raymond.hettinger@gmail.com>: ---------- assignee: docs@python -> mark.dickinson nosy: +mark.dickinson _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27601> _______________________________________
Changes by SilentGhost <ghost.adh@runbox.com>: ---------- resolution: fixed -> status: closed -> open _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27601> _______________________________________
Emanuel Barry added the comment: Do note that nothing has been changed in the docs yet. I submitted the patch, and now other developers need to review it, decide whether it's correct or need modifications, and then someone needs to commit it. Let the bikeshedding start =) ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27601> _______________________________________
R. David Murray added the comment: Adding a _ after a keyword is a very common trick. The fact that one got lost indicates that it isn't necessarily optimal :). I don't really have an opinion one way or the other on the variable rename. ---------- nosy: +r.david.murray _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27601> _______________________________________
Mark Dickinson added the comment: The changes look good to me. Thanks for spotting this! ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27601> _______________________________________
Roundup Robot added the comment: New changeset a6be689eacf8 by Berker Peksag in branch '3.5': Issue #27601: Improve example in the "Hashing of numeric types" section https://hg.python.org/cpython/rev/a6be689eacf8 New changeset 06bbcbaeeb18 by Berker Peksag in branch 'default': Issue #27601: Merge from 3.5 https://hg.python.org/cpython/rev/06bbcbaeeb18 ---------- nosy: +python-dev _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27601> _______________________________________
Berker Peksag added the comment: Looks good to me too. 'hash_value' looks more readable to me, thanks! ---------- nosy: +berker.peksag resolution: -> fixed stage: patch review -> resolved status: open -> closed type: -> behavior versions: -Python 3.2, Python 3.3, Python 3.4 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27601> _______________________________________
Aleksandr Koshkin added the comment: Originally I emphasized that this bug occurs at every py3k version since 3.2. For some reason version list somehow shrinked to only tow of them - 3.5 and 3.6. I am very sorry, this is probably my fault. ---------- resolution: fixed -> status: closed -> open versions: +Python 3.2, Python 3.3, Python 3.4 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27601> _______________________________________
Berker Peksag added the comment:
I am very sorry, this is probably my fault.
It's not your fault :) I removed them. 3.2, 3.3 and 3.4 are in security-fix-only mode so they won't get any documentation updates. You can read https://docs.python.org/devguide/devcycle.html#secbranch for details about security branches. Thanks for the report! ---------- resolution: -> fixed status: open -> closed versions: -Python 3.2, Python 3.3, Python 3.4 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27601> _______________________________________
participants (8)
-
Aleksandr Koshkin
-
Berker Peksag
-
Emanuel Barry
-
Mark Dickinson
-
R. David Murray
-
Raymond Hettinger
-
Roundup Robot
-
SilentGhost