Re:One-lined Python
by np_tedious on Thursday August 22, 2019 @06:15AM
(#20766434)
Python3 put it in functools, I think. Ah the need for an import would prevent one lining.
Never quite understood that decision
Reduce 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__
__import__('functools').reduce
> Your code could not be one-lined. name 'reduce' is not defined