SHARE
TWEET

Untitled

a guest Nov 3rd, 2012 50 Never
  1. def default(defaultval, f, allowNone=False, *args, **kwargs):
  2.     try:
  3.         ret = f(*args, **kwargs)
  4.         if ret is None and not allowNone:
  5.             return defaultval
  6.     except Exception as e:
  7.         return defaultval
  8.     return ret
RAW Paste Data
Top