Python's simplicity philosophy
Andrew Dalke
adalke at mindspring.com
Sat Nov 15 03:36:37 EST 2003
Douglas Alan:
> In Computer Science, however, "reduce" typically only has one meaning
> when provided as a function in a language, and programmers might as
> well learn that sooner than later.
There's also a __reduce__ and __reduce_ex__ in the pickle
protocol. See http://www.python.org/peps/pep-0307.html .
It's by far the most mentioned 'reduce' in the Python standard
library. Does it have anything to do with the 'reduce' function?
Not that I can tell. But I can't find an explaination for that
choice of a name.
> FAQ
> ---
> Q. Should I ever pass a function with side effects into reduce() or
> map()?
>
> A. No.
>
> (Unless the side-effect is just printing out debugging information,
> or saving away statistics, or something like that.)
Or raising an exception on error. And a true functional programmer
would say:
Q: Should I ever pass a function with side effects?
A: No.
;)
Andrew
dalke at dalkescientific.com
More information about the Python-list
mailing list