Python's simplicity philosophy
Dave Benjamin
ramen at lackingtalent.com
Fri Dec 5 22:47:51 EST 2003
In article <lcekvjaenb.fsf at gaffa.mit.edu>, Douglas Alan wrote:
> Lots of languages don't provide reduce() and lots of languages do. Few
> provide sum(). Higher-order functions such as reduce() are
> problematic in statically typed langauges such as C, C++, or Java,
> which may go a long way towards explaining why none of them include
> it. Neither C, C++, or Java provide sum() either, though PHP provides
> array_sum(). But PHP has a huge number of built-in functions, and I
> don't think that Python wishes to go in that direction.
Not that this contributes much to either side of this argument, but I just
want to mention that PHP *does* have a reduce function:
http://www.php.net/array_reduce
However, this requires pass-by-name and PHP has no support for closures, so
its usefulness is somewhat limited. PHP also has array_map() and
array_filter(), which do what you might expect...
Ducking out now,
Dave =)
--
.:[ dave benjamin (ramenboy) -:- www.ramenfest.com -:- www.3dex.com ]:.
: d r i n k i n g l i f e o u t o f t h e c o n t a i n e r :
More information about the Python-list
mailing list