Dot notation and datetime object


#1

Can someone explain to me the dot notation in this code?

now=datetime.now()

I know that now() refers to the method which belongs to the class datetime. Please take a look at the datetime.py module if needed
https://svn.python.org/projects/sandbox/trunk/datetime/datetime.py

what I'm confused about is the "datetime" part of now=datetime.now(). I read somewhere that it's supposed to be the instance of a class (the class is also called datetime if you look over the module) which the now() method belongs to, no? Since it's the instance shouldn't there be a line for the
code which is

datetime=datetime()

This is to specify that the datetime instance is part of the datetime class right?

I'm sorry if this question makes no sense at all, since it's only been a day since i do Python. Thank you for your time.


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.