map/filter/reduce/lambda opinions and background unscientific mini-survey
Terry Hancock
hancock at anansispaceworks.com
Wed Jul 6 02:58:14 EDT 2005
On Tuesday 05 July 2005 03:43 pm, Tom Anderson wrote:
> I understand that the backslash is popular in some ivory-tower functional
> languages. Currently, a backslash can be used for explicit line joining,
> and is illegal elsewhere on a line outside a string literal, so i think
> it's available for this. It would be utterly unpythonic to use puntuation
> instead of a keyword, and it would make no sense to novices, but it would
> scare the crap out of C programmers, which has to be worth something.
With list comprehensions and generators becoming so integral, I'm
not sure about "unpythonic". And a syntax just occured to me --
what about this:
[y*x for x,y]
?
(that is:
[<expression> for <argument list>]
It's just like the beginning of a list comprehension or generator, but
without the iterator. That implies that one must be given, and
the result is therefore a callable object.
Wouldn't do anything more or less than present day "lambda", but
gets rid of the weird keyword, and integrates nicely with list comps
and generators. It's currently a syntax error, and it requires no
special delimiter -- it's really just an extension of list comp syntax.
--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks http://www.anansispaceworks.com
More information about the Python-list
mailing list