4 ms·
Experienced in Python? This will take you less than one minute.
by wdroz 10y ago
Experienced in Python? This will take you less than one minute.
- zaptheimpaler 10y agoThe first line tipped me off :p def foo(a, methods=[]): # methods defaults to [] if not specified ohno.
- tomlock 10y agoI got that one, but the rest confused me - I need to work with lambdas more!
- jimmies 10y agoI don't even know Python, but after looking at it for a couple of minutes, I had a sense: 1. mutating the `methods` parameter directly, I don't even care if it works, is a bad idea 2. naming the thing methods and method might trip something up By just changing the code so that we declare the local methods array (name it methodsX or something else) to be empty, this fixed the first 3 problems (where the function is empty). I don't know enough of Python syntax to make it accept the second parameter being a array of functions.