Special variables: Difference between revisions

Content deleted Content added
Thundergnat (talk | contribs)
→‎{{header|Perl 6}}: Added perl 6 example
→‎{{header|Python}}: Expand __builtins__
Line 723: Line 723:


=={{header|Python}}==
=={{header|Python}}==
By default, Python starts execution in a namespace which has these globals defined:
By default, Python starts execution in a namespace which has direct access to names defined in the globals() dict and the __builtins__ dict. The members of which can be found by the following code:
<lang Python>names = sorted((set(globals().keys()) | set(__builtins__.__dict__.keys())) - set('_ names i'.split()))
<lang Python>print dir()</lang>
print( '\n'.join(' '.join(names[i:i+8]) for i in range(0, len(names), 8)) )</lang>
; Output
;Output
<pre>['__builtins__', '__doc__', '__file__', '__name__', '__package__']</pre>
<pre>ArithmeticError AssertionError AttributeError BaseException BufferError BytesWarning 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
ResourceWarning RuntimeError RuntimeWarning StopIteration SyntaxError SyntaxWarning SystemError SystemExit
TabError True TypeError UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError UnicodeTranslateError
UnicodeWarning UserWarning ValueError Warning WindowsError ZeroDivisionError __build_class__ __builtins__
__debug__ __doc__ __import__ __name__ __package__ abs all any
ascii bin bool bytearray bytes callable chr classmethod
compile complex copyright credits delattr dict dir divmod
enumerate eval exec exit filter float format frozenset
getattr globals hasattr hash help hex id input
int isinstance issubclass iter len license list locals
map max memoryview min next object oct open
ord pow print property quit range repr reversed
round set setattr slice sorted staticmethod str sum
super tuple type vars zip</pre>


=={{header|Tcl}}==
=={{header|Tcl}}==