Windows, IDLE, __doc_, other

Stephen Hansen apt.shansen at gmail.com
Mon Dec 21 17:11:13 EST 2009


On Mon, Dec 21, 2009 at 1:51 PM, W. eWatson <wolftracks at invalid.com> wrote:
> Lie Ryan wrote:
>>
>> On 12/22/2009 6:39 AM, W. eWatson wrote:
>>>
>>> Wow, did I get a bad result. I hit Ctrl-P, I think instead of Alt-P, and
>>> a little window came up showing it was about to print hundreds of pages.
>>> I can canceled it, but too late. I turned off my printer quickly and
>>> eventually stopped the onslaught.
>>>
>>> I couldn't get Alt-P or N to work.
>>>
>>> Another question. In interactive mode, how does one know what modules
>>> are active? Is there a way to list them with a simple command?
>>
>> What do you mean by "active"? All loaded modules, whether it is in your
>> namespace or not? Then sys.modules.
>> Else if you want all names in your namespace, dir() would do, though it'll
>> show other things as well.
>
> Let's forget active. Isn't it true that math is automatically available to
> every module? From help(math):

No, its not true. A built-in module does not mean its available
everywhere. It means its built into Python itself-- e.g., its directly
linked into the python dll and not a separate file (like most of the
the standard library).

Lots of modules are built-in, but they don't pollute the __builtins__
/ universal namespace. You import them to access them. If you want you
can "from math import *" if you want the math module to fill out your
module namespace (I don't recommend *'s personally, its better to
import symbols explicitly by name)

--S



More information about the Python-list mailing list