Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 74302db

Browse files
committed
Get rid of 'file' built-in. Get rid of types.StringType and friends.
1 parent 317e774 commit 74302db

3 files changed

Lines changed: 0 additions & 15 deletions

File tree

Lib/site.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,7 @@ class open:
414414
def __new__(cls, *args, **kwds):
415415
return io.open(*args, **kwds)
416416
__builtin__.classic_open = __builtin__.open
417-
__builtin__.classic_file = __builtin__.file
418417
__builtin__.open = open
419-
__builtin__.file = open
420418
sys.stdin = io.open(0, "r")
421419
sys.stdout = io.open(1, "w")
422420
sys.stderr = io.open(2, "w")

Lib/types.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,6 @@
2222
except NameError:
2323
pass
2424

25-
StringType = str
26-
27-
# StringTypes is already outdated. Instead of writing "type(x) in
28-
# types.StringTypes", you should use "isinstance(x, basestring)". But
29-
# we keep around for compatibility with Python 2.2.
30-
try:
31-
UnicodeType = str
32-
StringTypes = (StringType, UnicodeType)
33-
except NameError:
34-
StringTypes = (StringType,)
35-
3625
BufferType = buffer
3726

3827
TupleType = tuple
@@ -62,7 +51,6 @@ def _m(self): pass
6251
BuiltinMethodType = type([].append) # Same as BuiltinFunctionType
6352

6453
ModuleType = type(sys)
65-
FileType = file
6654

6755
try:
6856
raise TypeError

Python/bltinmodule.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2040,7 +2040,6 @@ _PyBuiltin_Init(void)
20402040
#endif
20412041
SETBUILTIN("dict", &PyDict_Type);
20422042
SETBUILTIN("enumerate", &PyEnum_Type);
2043-
SETBUILTIN("file", &PyFile_Type);
20442043
SETBUILTIN("float", &PyFloat_Type);
20452044
SETBUILTIN("frozenset", &PyFrozenSet_Type);
20462045
SETBUILTIN("property", &PyProperty_Type);

0 commit comments

Comments
 (0)