Re: Python's simplicity philosophy
In article <7x65hiahdp.fsf @ruckus.brouhah a.com>,
Paul Rubin <http://phr.cx@NOSPAM.i nvalid> wrote:
[color=blue]
> Ville Vainio <ville.spammeha rdvainio@spamtu t.fi> writes:[color=green]
> > 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).[/color]
>
> Python sometimes seems to go out of its way to thrwart the use of
> functional style. Look at list.sort returning None, for example.[/color]
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
In article <7x65hiahdp.fsf @ruckus.brouhah a.com>,
Paul Rubin <http://phr.cx@NOSPAM.i nvalid> wrote:
[color=blue]
> Ville Vainio <ville.spammeha rdvainio@spamtu t.fi> writes:[color=green]
> > 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).[/color]
>
> Python sometimes seems to go out of its way to thrwart the use of
> functional style. Look at list.sort returning None, for example.[/color]
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
Comment