def find_match():
for x in range(max_x):
for y in range(max_y):
if match(x, y):
return x, y
result = find_match()
if result is None:
# match not found
else:
x, y = result
Yup, looks clean to me, and the named "result" and "inner_function" give the opportunity for self-documentation, with appropriate names instead of "result" and "inner_function".
Image by mikebaird via Flickr
No comments:
Post a Comment