On Mon, 28 Dec 2009 14:42:21 -0800, W. eWatson wrote: > So as long as I don't print it, it's datetime.datetime and I can make > calculations or perform operations on it as though it is not a string, > but a datetime object?
No, it remains a datetime object regardless of whether you print it or not. Printing doesn't turn the object into a string, it leaves the object as-is and produces an additional string suitable for printing. This is no different from any other object: if you print a dict, or a int, or a list, the object doesn't turn into a string. When you say "print x", Python has no idea what information is appropriate to display for some arbitrary object x. So it asks x what is appropriate, by calling the __str__ method. That way Python only needs to know how to print one data type: strings. -- Steven -- http://mail.python.org/mailman/listinfo/python-list