I feel surprised that abs works on numpy array but not on lists. Why is that?
import numpy as np
abs(np.array((1,-2)))
array([1, 2])
abs([1,-1])
TypeError: bad operand type for abs(): 'list'
Also, built in functions like sum also works on numpy array. I guess it is because numpy array supports __getitem__? But in case of abs, if it depends on __getitem__ it should work for list as well, but it didn't.