I am wondering why this works
import datetime as dt
test1 = dt.datetime
print(test)
''' prints: <class 'datetime.datetime'>'''
So as far as I understand python, to create an instance of a class you need to call it with brackets like this:
test2 = dt.datetime(2021, 12, 31)
(Calling the constructor method forces you to put in year, month and day).
At first I thought calling datetime like in the first example (without the brackets) must be an attribute or something. But I can't find a single standing attribute "datetime" in the class "datetime".
And the funny thing is - it doesn't matter how you call it, because both lines lead to the same result:
test = dt.datetime
test2 = dt.datetime(2021, 12, 31)
print(test.now())
print(test2.now())
But why? What did I miss? Thanks a lot!