Require a default for dict.pop
- Dominant language
- Rust
- Stars
- 49.7k
- Forks
- 2.4k
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 458
Description
### Summary
Hi,
I know you are busy with bigger stuff, but documenting it for future, don't see similar issues.
[dict.pop](https://docs.python.org/3/library/stdtypes.html#dict.pop) has an optional default argument, but it's behaviour is different from [dict.get](https://docs.python.org/3/library/stdtypes.html#dict.get) - `pop` may raise a KeyError, but `get` never do it and IMO it's easy to forget how `pop` is working because `get` is used much more often.
Perhaps good to have a rule which requires to set a default, maybe if code is not handling KeyError, but not sure later is possible.
Contributor guide
Research direction
The issue names no Ruff files or tests. Start with the linked dict.pop and dict.get documentation, then inspect existing Ruff rules for comparable API-usage checks; done should include a settled scope for requiring a default and coverage for the proposed behavior, including KeyError handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100