Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does 'objects being subclassable' mean?

Tags:

python

Dive into Python -

Different programming languages define “object” in different ways. In some, it means that all objects must have attributes and methods; in others, it means that all objects are subclassable. In Python, the definition is looser; some objects have neither attributes nor methods (more on this in Chapter 3), and not all objects are subclassable (more on this in Chapter 5).

I am coming from C++/Java background.

like image 772
Vaibhav Bajpai Avatar asked Jul 03 '26 22:07

Vaibhav Bajpai


1 Answers

To be subclassable means that you can inherit from them. e.g.

class Foo(object):
    pass

object here is subclassable because Foo can inherit from it.

like image 81
krousey Avatar answered Jul 06 '26 10:07

krousey