4 ms·
Even if fixed to python 3, still throws an error: > Your code could not be one-lined. name 'reduce' is not defined
by trymas 7y ago
Even if fixed to python 3, still throws an error:
> Your code could not be one-lined. name 'reduce' is not defined
- np_tedious 7y agoPython3 put it in functools, I think. Ah the need for an import would prevent one lining. Never quite understood that decision
- gvx 7y agoReduce isn't used much. Things that tend to use reduce in languages like Haskell tend to be built from other primitives in Python. Instead of reduce, you could use https://docs.python.org/3/library/functions.html#__import__ https://docs.python.org/3/library/functions.html#__import__ __import__('functools').reduce
- jmmcd 7y agoThe article goes on to use `__import__()` to one-line imports.