"Frans Klaver" <fransklaver@xxxxxxxxx> writes: >>>> for line in lines: >>>> try: >>>> key, value = line.rstrip('\n').split(' ', 1) >>>> except ValueError: >>>> continue >>> >>> This is generally considered more pythonic: "It's easier to ask for >>> forgiveness than to get permission". >> >> Given that Junio explicitly wanted to allow lines with no spaces, I >> assume that lack of a space is not an error but rather a conceivable >> future extension. If my assumption is correct, then it is misleading >> (and inefficient) to handle it via an exception. > > I find the documenting more convincing than the efficiency, but from > the phrasing I think you do too. A line that consists entirely of non-SP may or may not a conceivable future extension, but the point is to "skip without barfing anything you do not understand". I wouldn't oppose the rewrite that uses try/except ValueError if "everything in this try block will parse what I understand correctly, and any ValueError exception this try block throws is an indication that I encountered what I do not understand and I must skip" is the more pythonic way to express that principle. Python is not my primary language as I said, and in addition StGit may have its own style I haven't learned. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html