advanced flow control Flashcards

1
Q

else with loops

A

else block perfoms when break doesn’t happen

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

while else can be useful for …

A

searching failure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

else with try

A

when no exceptions occured

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

dispatch on type decorator

A

@functools.singledispatch

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

example of using singledispatch

A

@singledispatch
def fun(arg):

@fun.register(int):
def _(arg):
    ...

@fun.register(list):

How well did you know this?
1
Not at all
2
3
4
5
Perfectly