Python notes

l.info(‘%s %s’,1,2)

foo();bar();

if True: do_something(); do_something_another()

A bare ‘except:’ clause will catch SystemExit and KeyboardInterrupt
exceptions, making it harder to interrupt a program with Control-C,
and can disguise other problems. If you want to catch all
exceptions that signal program errors, use ‘except Exception:’.

>>> def divide(x, y):
… try:
… result = x / y
… except ZeroDivisionError:
… print “division by zero!”
… else:
… print “result is”, result
… finally:
… print “executing finally clause”

>>> divide(2, 1)
result is 2
executing finally clause
>>> divide(2, 0)
division by zero!
executing finally clause
>>> divide(“2″, “1″)
executing finally clause
Traceback (most recent call last):
File ““, line 1, in ?
File ““, line 3, in divide
TypeError: unsupported operand type(s) for /: ‘str’ and ‘str’