From 74302dbd3cfd10aa3139f27644740ac6ca77cbd7 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 8 May 2007 17:20:32 +0000 Subject: [PATCH] Get rid of 'file' built-in. Get rid of types.StringType and friends. --- Lib/site.py | 2 -- Lib/types.py | 12 ------------ Python/bltinmodule.c | 1 - 3 files changed, 15 deletions(-) diff --git a/Lib/site.py b/Lib/site.py index c4e0d514a41..ba8603c9307 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -414,9 +414,7 @@ def installnewio(): def __new__(cls, *args, **kwds): return io.open(*args, **kwds) __builtin__.classic_open = __builtin__.open - __builtin__.classic_file = __builtin__.file __builtin__.open = open - __builtin__.file = open sys.stdin = io.open(0, "r") sys.stdout = io.open(1, "w") sys.stderr = io.open(2, "w") diff --git a/Lib/types.py b/Lib/types.py index 3c1c9390d7e..1d90012d9ed 100644 --- a/Lib/types.py +++ b/Lib/types.py @@ -22,17 +22,6 @@ try: except NameError: pass -StringType = str - -# StringTypes is already outdated. Instead of writing "type(x) in -# types.StringTypes", you should use "isinstance(x, basestring)". But -# we keep around for compatibility with Python 2.2. -try: - UnicodeType = str - StringTypes = (StringType, UnicodeType) -except NameError: - StringTypes = (StringType,) - BufferType = buffer TupleType = tuple @@ -62,7 +51,6 @@ BuiltinFunctionType = type(len) BuiltinMethodType = type([].append) # Same as BuiltinFunctionType ModuleType = type(sys) -FileType = file try: raise TypeError diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 46fbf777f4f..264470b1c69 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -2040,7 +2040,6 @@ _PyBuiltin_Init(void) #endif SETBUILTIN("dict", &PyDict_Type); SETBUILTIN("enumerate", &PyEnum_Type); - SETBUILTIN("file", &PyFile_Type); SETBUILTIN("float", &PyFloat_Type); SETBUILTIN("frozenset", &PyFrozenSet_Type); SETBUILTIN("property", &PyProperty_Type);