[ENH]: Using `IndexError` instead of `ValueError` at appropriate places?
Open
Nobody has claimed this yet.
enhancement
low priority
python
- Dominant language
- C++
- Stars
- 28.5k
- Forks
- 2.3k
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 62
Description
☑️ I understand it is strictly prohibited to use AI to write issues.
Following the suggestion, functions like expand_dims raise ValueError when the axis is invalid, but it makes more sense for them to raise IndexError instead.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the expand_dims API and trace related functions that validate axis arguments. Review existing exception behavior and tests for invalid axes, then determine which cases should use IndexError rather than ValueError. Done means the appropriate APIs consistently raise the intended exception and their existing tests reflect that behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100