[Tutor] Re: importing type

Bruce Sass bsass@freenet.edmonton.ab.ca
Mon, 5 Mar 2001 15:19:59 -0700 (MST)


On Mon, 5 Mar 2001, Doug Stanfield wrote:
<...>
> results.  When I do it from a direct interpreter session on Windows it looks
> like this:
>
> D:\PYTHON>python
> ActivePython 2.0, build 202 (ActiveState Tool Corp.)
> based on Python 2.0 (#8, Oct 19 2000, 11:30:05) [MSC 32 bit (Intel)] on
> win32
> Type "copyright", "credits" or "license" for more information.
> >>> dir()
> ['__builtins__', '__doc__', '__name__']
> >>> dir("__builtins_")
> ['capitalize', 'center', 'count', 'encode', 'endswith', 'expandtabs',
> 'find', 'i
> ndex', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle',
> 'isuppe
> r', 'join', 'ljust', 'lower', 'lstrip', 'replace', 'rfind', 'rindex',
> 'rjust', '
> rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title',
> 'tra
> nslate', 'upper']
> >>>
>
> It doesn't looke like 'type' is there.  Maybe in the IDLE environment it is
> already imported to make IDLE work.  Since there seems to be a difference,
> I'd suggest getting in the habit of importing what you need just for
> portability sake.

Very odd...

ActivePython 2.0, build 202 (ActiveState Tool Corp.)
based on Python 2.0 (#1, Oct 19 2000, 12:45:38)
[GCC 2.95.2 20000220 (Debian GNU/Linux)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> dir(__builtins__)
['ArithmeticError', 'AssertionError', 'AttributeError', 'EOFError',
<...>
'slice', 'str', 'tuple', 'type', 'unichr', 'unicode', 'vars',
'xrange', 'zip']
>>>

...and...

Python 1.5.2 (#0, Apr  3 2000, 14:46:48)  [GCC 2.95.2 20000313 (Debian
GNU/Linux)] on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> dir(__builtins__)
['ArithmeticError', 'AssertionError', 'AttributeError', 'EOFError',
<...>
'str', 'tuple', 'type', 'vars', 'xrange']
>>>


- Bruce