[Tutor] 2 problems in a small script
Alan Gauld
alan.gauld at btinternet.com
Sat Oct 13 01:19:52 CEST 2007
"Terry Carroll" <carroll at tjc.com> wrote
> It took me a while to get list comprehensions. It's one of those
> things
> that suddenly snaps into place and you're suddenly comfortable with.
Me too and I still don't like the syntax.
its the
[x for x in...
bit at the start that reads badly for me, I'd have preferred
if there was a seperator of some sort:
[x | for x in ...
or something. The problem is most punctuation is already
used for something that is valid in an expression. The only thing that
I think is OK is an exclamation mark but that, although somewhat
similar to a | looks like a factorial operarion.
But once you get used to it they are concise if not quite as
descriptive as their functional.equivalents map/filter.
Alan G.
More information about the Tutor
mailing list