an ugly file-reading pattern
Christian Tanzer
tanzer at swing.co.at
Mon Apr 14 12:45:40 EDT 2003
Skip Montanaro <skip at pobox.com> wrote:
> Christian> Maybe you should have written it as :
>
> Christian> open = file("somefile")
> Christian> for line in open:
> Christian> process(line)
>
> Christian> <2.2 wink>
>
> Yeah, stupid mistake. I had part of the OP's original solution (vrbl named
> file) and part of mine...
I wouldn't call it stupid, it was just not newbie-friendly in a
context like this.
Unfortunately, for a long time `file` was an obvious variable name for
an open file and old habits die hard. Grepping over my source tree
shows 183 occurrences of it.
--
Christian Tanzer tanzer at swing.co.at
Glasauergasse 32 Tel: +43 1 876 62 36
A-1130 Vienna, Austria Fax: +43 1 877 66 92
More information about the Python-list
mailing list