The type/object distinction and possible synthesis of OOP and imperative programming languages
Ian Kelly
ian.g.kelly at gmail.com
Tue Apr 16 14:22:42 EDT 2013
On Tue, Apr 16, 2013 at 11:29 AM, Ethan Furman <ethan at stoneleaf.us> wrote:
>>> 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
>
>
> Well that bumps our count to five then:
Six.
>>> class test(type(...)): pass
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: type 'ellipsis' is not an acceptable base type
More information about the Python-list
mailing list