On 06/11/2012 17:44, Julien Cristau wrote: > First, let me thank you for the patch. > > On Sat, Oct 27, 2012 at 12:54:40 +0100, Omega Weapon wrote: > >> I have forked the Bitbucket pylint repo and committed here: >> https://bitbucket.org/OmegaPhil/pylint/changeset/87bc90372e57064bb97866b47e34de12747889c1 >> > Couldn't > msgType = msg[0][:1] if len(msg[0]) > 1 else msg[0] > be rewritten as > msgType = msg[0][0] > ? >
I have not looked in depth as the code, but msg[0][0] will throw an IndexError if len(msg[0]) == 0, whereas the above code will set msgType to an empty list. Using msgType = msg[0][:1] will work regardless of len(msg[0]) (since slices never generate IndexError). -- Alexandre _______________________________________________ Python-Projects mailing list [email protected] http://lists.logilab.org/mailman/listinfo/python-projects
