A question about readability

Steven D'Aprano steve+comp.lang.python at pearwood.info
Fri Dec 7 15:10:19 CET 2012


On Fri, 07 Dec 2012 14:46:03 +0100, Marco wrote:

> Hi all, do you think this code:
> 
> $ more myscript.py
> for line in open('data.txt'):
>      result = sum(int(data) for data in line.split(';'))
>      print(result)
[...]
> is explicit enough? Do you prefer a clearer solution? Thanks in advance,

It's perfectly fine for such a simple script. It is readable and explicit.


-- 
Steven



More information about the Python-list mailing list