The type/object distinction and possible synthesis of OOP and imperative programming languages

Serhiy Storchaka storchaka at gmail.com
Tue Apr 16 04:25:53 EDT 2013


On 16.04.13 07:46, Ian Kelly wrote:
> On Mon, Apr 15, 2013 at 9:17 PM, Terry Jan Reedy <tjreedy at udel.edu> wrote:
>> I will keep the above in mind if I write or review a patch. here are 4
>> non-subclassable builtin classes. Two are already documented. Bool in one,
>> forget which other. I believe it was recently decided to leave the other two
>> as is given the absence of any practical use case.
>
> The four are bool, NoneType, slice and ellipsis, I believe.

 >>> import builtins
 >>> for n in dir(builtins):
...     if type(getattr(builtins, n)) is type:
...         try:
...             t = type(n, (getattr(builtins, n),), {})
...         except TypeError as e:
...             print(e)
...
type 'bool' is not an acceptable base type
type 'memoryview' is not an acceptable base type
type 'range' is not an acceptable base type
type 'slice' is not an acceptable base type





More information about the Python-list mailing list