Discrepancy between inplace add and add for list and iterables
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 36k
- PR merge metrics
- PR metrics pending
Description
Documentation
Noticed this discrepancy between inplace add and add for list and iterables, not sure if this behavior is purposefully intended or a bug:
The Addition Assignment += operator will concatenate str to list, treating the str as an iterable and behaving like list.extend(...) instead of throwing TypeError, as one might expect, since the Addition operator + throws a TypeError when attempting to concatenate str to list.
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
No source file or test is named. Start by reproducing the attached examples comparing list += with list + for strings and other iterables, then read the relevant Python language documentation for these operators. Done means the discrepancy's intended behavior is established and the appropriate documentation change or clarification is identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100