Éric Araujo mer...@netwok.org added the comment:
Out of curiosity: Any reason you used a containment test with a list instead of
a set (IMO more idiomatic, and in 3.2+ also optimized)? I guess it’s to match
the rest of the file, but using sets would not change any behavior.
--
Ezio Melotti ezio.melo...@gmail.com added the comment:
Good question. I considered using sets but then decided to use lists because
they don't get rid of duplicates and would make the test fail in the (indeed
unlikely) case that a keyword gets added twice (that's actually not possible in
Éric Araujo mer...@netwok.org added the comment:
I was too vague. I referred only to “if something in ['True', 'False',
'None']” in pydoc.py
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11926
Ezio Melotti ezio.melo...@gmail.com added the comment:
That's just because I'm used to Python 2 where the {} syntax for sets was not
available. I'll try to keep that in mind for the next time.
--
___
Python tracker rep...@bugs.python.org
Éric Araujo mer...@netwok.org added the comment:
True and False are keywords in 3.x for the parser (IIUC), even though they’re
still instances of bool.
--
nosy: +eric.araujo
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11926
R. David Murray rdmur...@bitdance.com added the comment:
As part of fixing this we should add a unit test to pydoc that goes something
like this:
assertEqual(sorted(pydoc.Helper.keywords.keys())), sorted(keyword.kwlist))
--
nosy: +r.david.murray
Ezio Melotti ezio.melo...@gmail.com added the comment:
+1
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11926
___
___
Python-bugs-list mailing
Ezio Melotti ezio.melo...@gmail.com added the comment:
Attached patch adds True/False/None to the list of keywords and a special-cased
path to have help('True'/'False'/'None') return the same as
help(True/False/None). I also added tests and found out that nonlocal was
missing too, so I added
Éric Araujo mer...@netwok.org added the comment:
I asked about nonlocal in #9724.
Patch looks good (I has to repress a gut reaction “eval is evil” :)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11926
Roundup Robot devnull@devnull added the comment:
New changeset 99d5542399a1 by Ezio Melotti in branch '3.1':
#11926: add missing keywords to help(keywords).
http://hg.python.org/cpython/rev/99d5542399a1
New changeset 7b4c853aa07d by Ezio Melotti in branch '3.2':
#11926: merge with 3.1.
Ezio Melotti ezio.melo...@gmail.com added the comment:
Fixed True/False/None in 3.1/3.2/3.3, nonlocal in 3.1 (it was already ok in
3.2/3.3), and backported tests on 2.7. Thanks for the pointer to #9724.
--
resolution: - fixed
stage: patch review - committed/rejected
status: open -
Sijin Joseph sijinjos...@gmail.com added the comment:
Should True, False and None be keywords? Technically True and False are objects
of type bool, in fact the only objects of that type allowed. And None is a
specially designated object as well.
P.S: Can anyone point me to where the help
Sijin Joseph sijinjos...@gmail.com added the comment:
@Ezio - help(True), help(False) and help(None) all return the correct
documentation for me using latest trunk. I think the quotes around True, False
and None might be throwing things off in your case.
--
Ezio Melotti ezio.melo...@gmail.com added the comment:
This can be fixed by adding 'False', 'None', and 'True' to the Helper.keywords
dict in Lib/pydoc.py. I'm not sure what the topic for these should be though.
True/False/None are documented in the built-in constants section[0] of the
doc.
New submission from Carl M. Johnson cmjohnson.mailingl...@gmail.com:
In Python 3.2, help(keywords) returns the following:
Here is a list of the Python keywords. Enter any keyword to get more help.
and elifimport raise
as else
Changes by Chris Rebert pyb...@rebertia.com:
--
nosy: +cvrebert
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11926
___
___
Python-bugs-list
Ezio Melotti ezio.melo...@gmail.com added the comment:
True, False and None are also included in keyword.kwlist:
keyword.kwlist
['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue',
'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global',
'if',
17 matches
Mail list logo