Removed builtins¶
Python's builtins module has far more names than this specification
has had reason to address — most of it, unaddressed, simply carries
over unchanged. This lists only the ones a specific design decision
elsewhere in this spec actually removes or replaces, each linked to
that decision:
tuple— no tuple type; use a class or!listproperty—getter/settermember syntax insteadstaticmethod— a function that needs noselforclsstays a functionclassmethod— a modifier keyword, not a decorator; a class method is declared, not wrappedNotImplemented— multiple dispatch replaces the reflected-method negotiation protocol it signalsisinstance,issubclass—is/is notbecome instance checks; identity moves to===/!==frozenset— as a call, replaced by the!marker on a set literal (!{a, b}); the type itself still exists, just not this constructortype— as a call returning a value's own class, sincetypeis a keyword now;class[X]covers the annotationtype[X]used toeval,exec— running code the checker never saw is exactly the escape hatch the type system has none of__import__— loading a module by a name computed at runtime is the same escape hatch one level up:importalready names its target statically, and there is no dynamic form behind it to call directlyvars— no__dict__to return;fieldsreplaces itdir—fieldsreplaces it too, on a module: an ordered, documented walk instead of an unordered list of bare namesnext— advancing an iterator by hand is rare enough that it needs no builtin:Iteratordeclaresnextas an ordinary method,cursor.next(), not a dunder with a wrapper function in front of itasciiis not a bare builtin. It moves tostring.ascii(...), in thestringmodule — a specific-audience string-formatting operation, the same reasoning that keepsiteration.donein theiterationmodule instead of built in.filter— a comprehension with anifclause already does this:[x for x in y if condition], one spelling instead of twoglobalsis supplanted bylocals— nothing else. There is no separate global scope to reach past locals for: at any point in the source, everything visible already is the locals, the same reason assignment is always local onceglobalis gone — nothing privileges module scope as a separately reachable, dict-shaped thingglobals()could hand back thatlocals()doesn't already covercompile— not a bare builtin; tucked into a library alongside other code-object and reflection tools, not exposed at the top leveldelattr— the same ruledel obj.fieldalready breaks on; a declared field is part of a class's fixed shape, not an optional slot a call can removeopen— not a bare builtin;Path.open(...)already exists alongside it in Python, so keeping both is one spelling too manybin,oct,hex— not bare builtins; they move tostr.bin,str.oct, andstr.hex, named factories instead of three unrelated top-level names for the same jobchr,ord— not bare builtins; they move tostring.chr(...)andstring.ord(...), the same specific-audience moveasciialready makesbytes,bytearray,memoryview— not separate conversion functions;Bytes(x),ByteArray(x), andMemoryView(x)already construct through each type's own default factory, the same way any other class is constructed, so there is no second, lowercase name left to call instead