Chapter 1. The __init__() Method
The __init__()
method is profound for two reasons. Initialization is the first big step in an object's life; every object must be initialized properly to work properly. The second reason is that the argument values for __init__()
can take on many forms.
Because there are so many ways to provide argument values to __init__()
, there is a vast array of use cases for object creation. We take a look at several of them. We want to maximize clarity, so we need to define an initialization that properly characterizes the problem domain.
Before we can get to the __init__()
method, however, we need to take a look at the implicit class hierarchy in Python, glancing, briefly, at the class named object
. This will set the stage ...
Get Mastering Object-oriented Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.