Python's simplicity philosophy

Alex Martelli aleax at aleax.it
Fri Nov 14 12:12:32 EST 2003


eichin at metacarta.com wrote:
   ...
> that kind of array handling.  But the point here is that "reduce" is
> fundamental: x/i5 (where x is multiplication-sign and i is iota) is
> a lot like reduce(int.__mul__, range(1,6)), it's just "readable" if

I disagree about "is a lot like" -- I think Numeric Python's

    mul.reduce(arrayrange(1, 6))

is much closer to APL (sure, spelling "iota 5" as "arrayrange(1, 6)"
may be alien, but the point is that .reduce in Numeric, like / in APL,
is a property of OPERATORS [ufuncs, in Numeric], NOT a generic FP
tool like Python's built-in reduce).

> of poking around.)  On the other hand, that readability does assume
> you're thinking in terms of throwing arrays around, which can be
> an... *odd* way of looking at things, though of course when it fits,
> it's very nice.

That's the reason I'm happier to have it in a separate package, be
it Numeric or its successor numarray, than built into the language --
just like, e.g., regular expressions are a separate module in Python
but built into languages such as Perl or Ruby.  Keeping the core
language simpler and other modules/packages rich is a strategy which
I think Python uses to excellent effect.


Alex





More information about the Python-list mailing list