On 2010-12-16, John Gordon <gor...@panix.com> wrote: > I like this style more, mostly because it eliminates a lot of indentation. > > However I recall one of my college CS courses stating that "one entry, > one exit" was a good way to write code, and this style has lots of exits.
So, take the good intentation from one and the single exit from the other: def myMethod(self, arg1, arg2): if some_bad_condition: exitCode = bad1 elif some_other_bad_condition: exitCode = bad2 elif yet_another_bad_condition: exitCode = bad3 else: exitCode = do_some_useful_stuff() # possible common cleanup code here return exitCode Or, raise an exception on bad condtions rather then passing an error code. -- http://mail.python.org/mailman/listinfo/python-list