"if {negative}" vs. "if {positive}" style
Ethan Furman
ethan at stoneleaf.us
Wed Feb 10 15:56:02 EST 2010
Tim Chase wrote:
> Any thoughts on how others make the choice?
>
> -tkc
If one branch is only a few lines, it comes first. As often as not,
that tiny branch is checking for errors, and the "else" branch doesn't
need to be indented.
def func(arg1):
if arg1 is 'stupid':
raise ValueError("that's a stupid argument!")
do_something
do_something_else
etc, etc
~Ethan~
More information about the Python-list
mailing list