a comment why TypeError is used would be good, see https://github.com/numpy/numpy/pull/3379#discussion_r4717705