reading file to list

Rhodri James rhodri at wildebst.demon.co.uk
Wed Jan 21 21:01:23 EST 2009


On Wed, 21 Jan 2009 09:42:19 -0000, Lars Behrens <spam.buster at web.de>  
wrote:

> Rhodri James wrote:
>
>> I *was* thinking of code produced in the real world, and I don't buy
>> your assertion.  I'm not an academic, and I wouldn't hesitate to lay
>> down a line of code like that.  As I said before, it fits into English
>> language idioms naturally, and as a result is pretty self-descriptive.
>
> As a non-native speaker and non-academic, I don't understand the "fittine
> into English language idioms naturally" which is mentioned here in the
> different subthreads. Could you try to explain that for me?

It just means that the progamming language concept in question has the
same "shape" (i.e. roughly the same syntax) as an English language
syntactic construct in common use.  So for list comprehensions we have

   [ f(x) for x in l ]

and

   "Make a list of f(x) for each x in the list l."

You can see how the elements of the list comprehension fit sequentially
into the English sentence.  As other people have pointed out, this
particular example really comes from the mathematical notation for
constructing sets:

   f(x) ∀ x ∊ l

...but it's no accident that they both "translate" straightforwardly
into English!

-- 
Rhodri James *-* Wildebeeste Herder to the Masses



More information about the Python-list mailing list