code blocks
Peter Otten
__peter__ at web.de
Mon May 11 12:01:12 EDT 2015
Chris Angelico wrote:
> On Tue, May 12, 2015 at 1:22 AM, zipher <dreamingforward at gmail.com> wrote:
>> Ah, yeah, I guess that does it. But (shame) it looks like you've gone
>> past the BDFL. Try:
>>
>>>>> help(exec)
>> ^
>> SyntaxError: invalid syntax
>>
>
> That's because, in the version of Python you're using, exec is a
> keyword. You could switch to Python 3, where it's a function, or
> request it by name. 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
>>> help("exec")
The ``exec`` statement
[...]
>>> import sys
>>> sys.path.insert(0, "/usr/lib/python3.4")
>>> del sys.modules["pydoc_data"]
>>> del sys.modules["pydoc_data.topics"]
>>> help("exec")
no documentation found for 'exec'
More information about the Python-list
mailing list