[FRPythoneers] iterator like inject:into to generating comma-separated list
jason.songhurst at valtech.com
Mon Sep 16 20:14:48 MDT 2002
Sean Reifschneider wrote:
> On Mon, Sep 16, 2002 at 07:25:25PM -0500, Cameron Laird wrote:
>> string.join(map(str, list), ",")
> Sure, but which one is the One True Way (tm)? ;-)
Guido van Rossum, the BDFL, wrote in 1996:
Opinions on ugliness can vary, but personally, I just wish I'd never
given in to the pressure to add lambda in the first place.
And even recently the BDFL called lambda a 'failed experiment'.
But Fredric Lundh, someone who must be passing familiar with the One
True Way (Python version) (tm), wrote about using lambdas:
If you like lambdas, use them. All the best pythoneers do, so why
I have found that after using Scheme, lambdas in Python seem awkward.
Of course that situation is better with the advent of nested scopes, but
the syntax makes lambdas usually look clunky compared to the rest of Python.
However, from the docstring in string.py:
Warning: most of the code you see here isn't normally used nowadays.
With Python 1.6, many of these functions are implemented as methods
on the standard string object.
So the 'string.join(words, sep)', is not the One True Way (tm). But I
think it is very close...
Why not try something which is clear, consise, object-oriented,
applicative (to satisfy the lambda deep within us all), and modern:
or use lambda. <grin>
More information about the FRPythoneers