On Thu, Apr 24, 2008 at 11:23 AM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> This is getting off-topic, so you don't need to answer; I still ask: > Why??? yes I know, apologies for not mailing the right list. I'll try to do so next time. Dividing the previous result seems more logical: minutes = seconds/60, hours=minutes/60, days=hours/24, not minutes=seconds/60, hours=seconds/3600, days=seconds/86400. Also, if you do something like adding years, it's simple--you just append to the list versus change the last thing to a modulo and add another unit. If you add years, changing days to sidereal days would also be easier with the list. Also, you don't have to check multiplication, etc. [in answer to your next question as well] The example was created to show the ability to express things with reduce, not necessarily to quickly calculate human readable time. > Even after knowing what this does, I still cannot easily understand > how it does that. I think having reduce produce a growing value, and > passing it an inhomogeneous list, is just deep abuse. I guess I am likely to agree: the function is not associative or commutative, and unable to be parallelized--one of the reasons reduce was created. > In any case, writing multiple lines is good, writing a single line only > is bad. I don't agree. If it's code you want to write once and never look at again, having it out of the way can be nice.
_______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com