Multiple "cmp"s chained one after another

Peter Hansen peter at engcorp.com
Sat May 14 19:43:29 EDT 2005


Volker Grabsch wrote:
> Peter Hansen wrote:
> 
>>Or just use the .timetuple() method on datetime objects and sort on the 
>>8th element of the 9-element tuple, which is the day-of-the-year.
> 
> An interesting idea. But wouldn't sorting by (dd.month,dd.day) be more
> effective?

Depending on the meaning of "effective", I suppose so.

> In other words: Does .timetuple() create a tuple, or does it just return
> a tuple which is present anyway?

I don't know what it does.  Normally one shouldn't care about that kind 
of thing.  In this case, you seem to be assuming that .month and .day 
are values that are "present anyway", but we don't really know that 
either, since they could just as well be properties.  If someone who 
knows or someone who checks the source (for a given implementation of 
course... it could change) cares to share, we'd know more.  What good 
that would do us is still a mystery to me. ;-)

-Peter



More information about the Python-list mailing list