:
handlers = { reg1 : handleReg1, ... }
for line in fi.readlines():
for h in handlers:
x = h.match(line)
if x:
handlers[h](x)
, , , : . break , , . , , :
handlers = [ (reg1, handleReg1), (reg2, handleReg2), ... ]
for line in fi.readlines():
for reg, handler in handlers:
x = reg.match(line)
if x:
handler(x)
break