How to read the Python tutorial?

Ian ian.g.kelly at
Wed Nov 10 22:54:08 CET 2010

On Nov 10, 8:13 am, Zeynel <azeyn... at> wrote:
> But when I try
> datetime.datetime.mDATE.toordinal())
> I get AttributeError.

Others have already explained why "mDATE.seconds" does not work, but I
wanted to touch on this as well.  The above fails because "mDATE" is
not an attribute of the "datetime.datetime" class, which is to be
expected since you've merely defined it as a local variable.  If you
want to call the "toordinal" method of mDATE, just do this:


or this:


But in most cases the first version is preferred.

As an aside, your capitalization scheme would drive me insane.  I
suggest reading PEP 8, the Python style guide, and following the
recommendations there.  Also, it is not customary in Python to prefix
attribute names with the string "m" or "m_" as it is in C++.  Because
Python does not do implicit attribute lookup, it is always clear from
context whether a name refers to an attribute or not, and so the "m"
is superfluous.


More information about the Python-list mailing list