On Monday, May 11, 2015 at 11:08:14 AM UTC-5, Chris Angelico wrote: > On Tue, May 12, 2015 at 2:01 AM, Peter Otten <__pete...@web.de> wrote: > > Though interestingly, my Py2 doesn't have any help > >> on exec: > >> > >>>>> help('exec') > >> no documentation found for 'exec' > >> > >> Not sure why that is. > > > > Path confusion? You may accidentally be importing Python 3's topics. > > Try > > > >>>> from pydoc_data import topics > >>>> topics.__file__ > > '/usr/lib/python2.7/pydoc_data/topics.pyc' > >>>> "exec" in topics.topics > > True > > Peculiar. > > $ python > Python 2.7.3 (default, Mar 13 2014, 11:03:55) > [GCC 4.7.2] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> from pydoc_data import topics > >>> topics.__file__ > '/usr/lib/python2.7/pydoc_data/topics.pyc' > >>> "exec" in topics.topics > False > >>> topics.topics.keys() > ['conversions', 'debugger', 'attribute-access', 'augassign', > 'numeric-types', 'context-managers', 'bitwise', 'global', 'numbers', > 'customization', 'in', 'floating', 'integers', 'naming', 'if', > 'binary', 'raise', 'for', 'typesmapping', 'subscriptions', > 'specialnames', 'typesseq', 'dynamic-features', 'bltin-code-objects', > 'continue', 'dict', 'bltin-type-objects', 'import', 'typesmethods', > 'pass', 'atom-literals', 'slicings', 'function', 'typesseq-mutable', > 'bltin-ellipsis-object', 'execmodel', 'return', 'exprlists', 'power', > 'booleans', 'string-methods', 'assignment', 'callable-types', 'yield', > 'lists', 'else', 'assert', 'formatstrings', 'objects', 'shifting', > 'unary', 'compound', 'typesfunctions', 'imaginary', 'specialattrs', > 'with', 'class', 'types', 'break', 'calls', 'try', 'identifiers', > 'atom-identifiers', 'id-classes', 'bltin-null-object', 'while', > 'attribute-references', 'del', 'truth', 'sequence-types', > 'exceptions', 'comparisons', 'operator-summary', 'typesmodules', > 'strings', 'lambda'] > > Whatever. I've made a few messes on this system, maybe I broke > something somewhere. In any case, help('exec') is what's needed for > help on keywords, even if one particular installation doesn't have one > particular keyword-help. > > ChrisA
It's strange, help(eval) works but help(exec) creates a SyntaxError, even though they would seem to be the same semantically -- both imperative verbs. You nailed it by calling "exec" a keyword, but still it's a strange distinction. Mark -- https://mail.python.org/mailman/listinfo/python-list