Coding style and else statements

tobiah st at tobiah.org
Mon Aug 28 17:41:11 EDT 2006


def foo(thing):

	if thing:
		return thing + 1
	else:
		return -1

def foo(thing):

	if thing:
		return thing + 1
	return -1

Obviously both do the same thing.  The first is
possibly clearer, while the second is more concise.

Comments?

-- 
Posted via a free Usenet account from http://www.teranews.com




More information about the Python-list mailing list