advanced flow control Flashcards
1
Q
else with loops
A
else block perfoms when break doesn’t happen
2
Q
while else can be useful for …
A
searching failure
3
Q
else with try
A
when no exceptions occured
4
Q
dispatch on type decorator
A
@functools.singledispatch
5
Q
example of using singledispatch
A
@singledispatch
def fun(arg):
…
@fun.register(int): def _(arg): ...
@fun.register(list):
…