Question on style.

Alex cut_me_out at hotmail.com
Mon Sep 11 14:30:33 EDT 2000


Hi, everyone.  

I should start with the disclaimer that this concerns python 2.0
features.  Apologies for any cruelty this inflicts. <wink>

The new features feel a little like the functional programming features
that used to be available in python.  When I first started programming,
I used them a lot, but gradually stopped when I noticed experienced
people weren't, and their code was easier to follow than mine.  But I
don't have any examples against which to judge my use of the new
features.  So I was hoping to run some examples past people with more
experience in the languages those features have been taken from.  For
instance, what do you all think about nested list comprehensions like
this?  Do you think it's as easy to follow as the corresponding for
loops?

# Separate the triple of scores for each sequence into separate parallel
# lists for each frame.
frames = [[score[frame] for score in scores] \
          for frame in range(3)]

Alex.

-- 
Speak softly but carry a big carrot.




More information about the Python-list mailing list