On 3/7/2016 6:29 PM, Rob Gaddi wrote:

You're used to Perl, you're used to exceptions being A Thing.  This is
Python, and exceptions are just another means of flow control.

class MalformedLineError(Exception): pass

for line in file:
     try:
         for part in line.split('\t'):
             if thispartisbadforsomereason:
                 raise MalformedLineError()
             otherwisewedothestuff
     except MalformedLineError:
         pass


I am sure you are right, but adapting this thing here into something that is a fix to my problem seems like abusing my 'system 2' (for those who read a certain book by a guy called Daniel Kanheman :)

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to