[ python-Bugs-1118977 ] builtin file() vanishes
SourceForge.net
noreply at sourceforge.net
Thu Feb 10 01:02:23 CET 2005
Bugs item #1118977, was opened at 2005-02-09 00:42
Message generated for change (Settings changed) made by loewis
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1118977&group_id=5470
Category: None
Group: None
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Barry Alan Scott (barry-scott)
Assigned to: Nobody/Anonymous (nobody)
Summary: builtin file() vanishes
Initial Comment:
The attached files reproduce a wierd problem where by
the builtin file() function completely vanishes from
python.
Notice that __builtin__ changes type from module to dict.
In the attached tar files find:
manufacture - main program
bob.py - module
a.a - file to open
Untar and run:
python manufacture
Notice that file()is no ware to be found in side of bob.py
This runs the same on all 2.3 and 2.4 on Windows, Linux
and Mac OS X.
----------------------------------------------------------------------
>Comment By: Martin v. Löwis (loewis)
Date: 2005-02-10 01:02
Message:
Logged In: YES
user_id=21627
As Tim says, __builtins__ is a dictionary sometimes.
Therefore, it is no surprise that __builtins__.file does not
exist - dictionaries don't have a file attribute. As this is
apparently what you meant when you said that file()
"vanishes", I'm closing the report as invalid.
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2005-02-09 04:51
Message:
Logged In: YES
user_id=31435
No, __builtins__ (note the trailing 's') changes type from
module to module, not __builtin__. __builtins__ is an
implementation detail, and you shouldn't use it at all.
__builtin__ (no trailing 's') is a built-in module, and you're free
to use that, but then you have to import it explicitly:
import __builtin__
__builtin__.file
There's more in the Language (not Library) reference manual,
in the section "Naming and Binding".
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1118977&group_id=5470
More information about the Python-bugs-list
mailing list