Python – Object Initialized Inside a Class?

object-orientedpython

Is possible and, if so, common practice to initialize an object inside a class in Python?

self.field = Class()

Best Answer

Everything in Python is an object, so yes, this is common practice. You could not create a meaningful Python program without creating other instances in your own classes.

Related Topic