Difference Between Two datetimes

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Mon Dec 28 18:36:35 EST 2009


On Mon, 28 Dec 2009 23:22:09 +0100, Peter Otten wrote:

> print some_object
> 
> first converts some_object to a string invoking str(some_object) which
> in turn calls the some_object.__str__() method. The resulting string is
> then written to stdout. 

In fairness to the OP, that's a misleading way of describing it. Python 
doesn't convert objects in the standard senses of "convert lead into 
gold" or "convert to <insert name of religion here>". some_object.__str__ 
returns an independent string object while leaving some_object alone.

But I'm sure you knew that already -- it's only the OP who was confused.


-- 
Steven



More information about the Python-list mailing list