python / python/cpython

Discrepancy between inplace add and add for list and iterables

オープン
#96,770 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

docs
主要言語
Python
スター
77.2k
フォーク
36k
PR マージ指標
PR 指標を取得中

説明

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.

code snippet

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

ソースファイルもテストも指定されていません。まず、文字列やその他の iterable について list += と list + を比較する添付の例を再現し、その後、これらの演算子に関する関連する Python 言語ドキュメントを読んでください。差異の意図された動作が確立され、適切なドキュメントの変更または明確化が特定されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
documentation
issue の種類
ドキュメント
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。