Windows, IDLE, __doc_, other

W. eWatson wolftracks at invalid.com
Mon Dec 21 16:51:44 EST 2009


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):
================
Help on built-in module math:

NAME
     math

FILE
     (built-in)

DESCRIPTION
     This module is always available.  It provides access to the
     mathematical functions defined by the C standard.
=================
So why do I need math.cos(...)? This is got to be some namespace issue.

Maybe the help is incorrect. I have:
 >>> dir(__builtins__)
['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 
'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', 
'Exception', 'False', 'FloatingPointError', 'FutureWarning', 
'GeneratorExit', 'IOError', 'ImportError', 'ImportWarning', 
'IndentationError', 'IndexError', 'KeyError', 'KeyboardInterrupt', 
'LookupError', 'MemoryError', 'NameError', 'None', 'NotImplemented', 
'NotImplementedError', 'OSError', 'OverflowError', 
'PendingDeprecationWarning', 'ReferenceError', 'RuntimeError', 
'RuntimeWarning', 'StandardError', 'StopIteration', 'SyntaxError', 
'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'True', 
'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 
'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', 
'UnicodeWarning', 'UserWarning', 'ValueError', 'Warning', 
'WindowsError', 'ZeroDivisionError', '_', '__debug__', '__doc__', 
'__import__', '__name__', 'abs', 'all', 'any', 'apply', 'basestring', 
'bool', 'buffer', 'callable', 'chr', 'classmethod', 'cmp', 'coerce', 
'compile', 'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 
'divmod', 'enumerate', 'eval', 'execfile', 'exit', 'file', 'filter', 
'float', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help', 
'hex', 'id', 'input', 'int', 'intern', 'isinstance', 'issubclass', 
'iter', 'len', 'license', 'list', 'locals', 'long', 'map', 'max', 'min', 
'object', 'oct', 'open', 'ord', 'pow', 'property', 'quit', 'range', 
'raw_input', 'reduce', 'reload', 'repr', 'reversed', 'round', 'set', 
'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 
'tuple', 'type', 'unichr', 'unicode', 'vars', 'xrange', 'zip']



More information about the Python-list mailing list