From the lesson -
Classes can also have additional constructors, so objects can be defined in multiple ways. The datetime class has one of these that we can use to parse dates directly from strings.
The datetime.strptime() constructor returns a datetime object
I tried to look through Python’s source code and found this -
Just about the method definition, we see the decorator
@classmethod. And there’s nothing else which clearly helps me understand why this isn’t a method, but a constructor instead. So, I am not entirely sure why in the lesson it’s called a constructor, but the source code puts it differently.
Can anyone explain the distinction between the normal constructor (
__init__()), other constructors (like in the lesson,
strptime() is considered a constructor), and how methods and constructors truly differ?