iterating over lines in a file

Moshe Zadka moshez at math.huji.ac.il
Mon Jul 24 08:21:08 EDT 2000


On Mon, 24 Jul 2000, nobody wrote:

> what i was actually trying to do was a prepend-this-string-to-that-file
> routine, and i think i got it. the straight translation from perl got
> really, really long due to all the try-except pairs; i like exceptions
> better than perl's "do {} or die" idiom as they're clearer and seem more
> flexible, but they're sure more verbose, too.

As a rule, if you find your code littered with try/except's, you're
probably doing something wrong. They're called exceptions for a reason.
--
Moshe Zadka <moshez at math.huji.ac.il>
There is no IGLU cabal.
http://advogato.org/person/moshez





More information about the Python-list mailing list