IN Perl it's quite common to do things like function() || alternative()
. If the first returns false it will run the second one.
How can this be easily implemented in Python?
Update
Examples (pseudocode):
x = func() or raise exeption
x = func() or print(x)
func() or print something
If possible solutions should work with Python 2.5+
Note: There is an implied assumption that you cannot modify the func() to raise exceptions, nor to write wrappers.