Python's simplicity philosophy

David Eppstein eppstein at ics.uci.edu
Mon Nov 17 15:11:22 EST 2003


In article <7x65hiahdp.fsf at ruckus.brouhaha.com>,
 Paul Rubin <http://phr.cx@NOSPAM.invalid> wrote:

> Ville Vainio <ville.spammehardvainio at spamtut.fi> writes:
> > I wouldn't mind Python getting more influence from functional realm,
> > as Python seems to me to be *the* hybrid language that can pull the FP
> > thing while still remaining practical and intuitive (and delightfully
> > non-academic).
> 
> Python sometimes seems to go out of its way to thrwart the use of
> functional style.  Look at list.sort returning None, for example.

The issue here is not that it returns None, but that it changes its 
input.  To be truly functional, it should return a new list and leave 
the original list unchanged.  Returning None is just a helpful reminder 
that it's not functional.  Of course, the functional version would often 
be less efficient...

-- 
David Eppstein                      http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science




More information about the Python-list mailing list