I know this suggestion is withdrawn and the thread all but finished, but
for completion, I'd like to answer one of Chris' questions:
On Fri, Nov 12, 2021 at 04:48:58AM +1100, Chris Angelico wrote:
> I'll have to get someone else to confirm, but I believe that str, int,
> etc were functions for a lot of Python's history.
I don't know if the first eleven years counts as "a lot" of Python's
history (it's about 1/3rd of Python's existence at this point), but in
Python 1.x and some of 2.x, str, int, float, list etc were all actual
functions and couldn't be subclassed:
[steve@ando ~]$ python1.5
Python 1.5.2 (#1, Aug 27 2012, 09:09:18) [GCC 4.1.2 20080704 (Red
Hat 4.1.2-52)] on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>>
>>> class MyString(str): pass
...
Traceback (innermost last):
File "<stdin>", line 1, in ?
TypeError: base is not a class object
>>>
>>> type(str)
<type 'builtin_function_or_method'>
There were two distinct object heirarchies. Builtin *types* str, int ...
were different kinds of objects to the classes and instances you created
with the `class` keyword.
>>> type(type('a'))
<type 'type'>
>>>
>>> class C: pass
...
>>> type(C)
<type 'class'>
It wasn't until Python 2.2 that builtin types and classes were unified,
becoming the same thing; the functions str, int, etc became classes; and
every object in Python was consolidated into a single heirarchy with
`object` as the root.
https://www.python.org/download/releases/2.2.3/descrintro/
--
Steve
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/G2TYMDMIKVOZG2355OAFCTMK5AXGAIQN/
Code of Conduct: http://python.org/psf/codeofconduct/