Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # for https://chat.stackoverflow.com/transcript/message/51671357#51671357
- def looper():
- def lst1_func():
- nonlocal i1, a, b, c, d
- # do stuff
- def lst2_func():
- nonlocal i2, a, b, c, d
- # do stuff
- # def lst3_func, lst4_func here
- triplets = [(lst1, lst1_func, lambda x: x.upper() in bar),
- (lst2, lst2_func, lambda x: x in foo),
- (lst3, lst3_func, lambda x: x),
- (lst4, lst4_func, lambda x: x not in lst1),
- ]
- for lst, func, condition in triplets:
- for item in lst:
- if condition(item):
- return
- func()
- print('Never broke')
- looper()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement