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

Terry Jan Reedy tjreedy at udel.edu
Mon Apr 15 23:17:36 EDT 2013


On 4/15/2013 10:32 PM, Steven D'Aprano wrote:
> On Mon, 15 Apr 2013 20:52:58 -0400, Terry Jan Reedy wrote:

>> Some builtin classes cannot be subclassed. There is an issue to document
>> which better. That does not mean that it is not a class.
>
>
> I think it is also important to document whether that is a language
> feature, or a mere restriction of the implementation. There is an
> important distinction to be made between:
>
> "In CPython, you cannot subclass slice or FunctionType. Other Pythons may
> have more, or fewer, restrictions."
>
> and:
>
> "No language that calls itself Python is permitted to allow slice and
> FunctionType to be subclassable."
>
>
> If I had a say in this, I would vote for the first case, with the
> possible exception of documented singleton types like NoneType and bool.

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.





More information about the Python-list mailing list