MCPcopy Create free account
hub / github.com/ActiveState/code / newfunc

Function newfunc

recipes/Python/500274_exceptihandling_using/recipe-500274.py:14–26  ·  view source on GitHub ↗
(t,*args, **kwargs)

Source from the content-addressed store, hash-verified

12 t = [(Exception,None)]
13
14 def newfunc(t,*args, **kwargs):
15 ex, handler = t[0]
16
17 try:
18 if len(t) == 1:
19 f(*args, **kwargs)
20 else:
21 newfunc(t[1:],*args,**kwargs)
22 except ex,e:
23 if handler:
24 handler(e)
25 else:
26 print e.__class__.__name__, ':', e
27
28 return functools.partial(newfunc,t)
29 return wrapper

Callers

nothing calls this directly

Calls 2

fFunction · 0.50
handlerFunction · 0.50

Tested by

no test coverage detected