# Handwritten Reduce
| See | About |
| --------------------------- | --------------------------- |
| [[Anti-Patterns of Python]] | [[NIH - Not Invented Here]] |
```python
# Don't
def pipeline(function, start, *elements):
for elem in elements:
start = function(start, elem)
return x
print(pipeline(pow, 1, [2, 3, 4]))
# Do
print(functools.reduce(pow, [1, 2, 3, 4]))
```
---
Bibliography:
- [functools.reduce - docs.python.org](https://docs.python.org/3/library/functools.html#functools.reduce)