code blocks

Peter Otten __peter__ at web.de
Mon May 11 12:59:46 EDT 2015


Chris Angelico wrote:

> On Tue, May 12, 2015 at 2:01 AM, Peter Otten <__peter__ at 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']

Note that "print" is missing, too.

> Whatever. I've made a few messes on this system, maybe I broke
> something somewhere. 

Probably.

> 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.





More information about the Python-list mailing list