I can create a method in a box that overwrite a key
まだ誰も着手していません。
評価
調査の方向性
まず、Boxを使ってサブクラスの例を再現し、競合する"print"キーについてドットアクセスとブラケットアクセスを比較します。payloadには実装ファイルもテストも指定されていません。Boxの属性検索とキー検索の動作を追跡し、そのうえで意図された結果が警告なのか、文書化された動作なのかを確認します。
索引モデルが issue の本文から書いたものです。
説明
I was playing with the lib by subclassing it and I founds some funny behaviour. I know it's not the intended usage but though that was worth reporting. Feel free to close it if you think it's useless:
class toto(Box):
def __init__(self, valeur):
super().__init__({"valeur": [valeur, valeur], "print": "toto"})
def print(self):
print(self.valeur)
return
toto("truc").print
>>>><bound method toto.print of Box({'valeur': ['truc', 'truc'], 'print': 'toto'})>
I didn't know what to expect but it's the method that have priority over the key.
but the key still exist
toto("truc")["print"]
>>>>'toto'
I think it would be handy to at least raise a warning ?
- 主要言語
- Python
- スター
- 2.8k
- フォーク
- 145
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
cdgriffith/Box のほかの issue
-
subclass of `Box` does not unpickle correctly対応中かも @koriyoshi2041 が 143 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
cdgriffith/Box#308 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
cdgriffith/Box#307 · コメント 1 件 ·
-
Dotted keys read from YAML are lost with box_dots / default_box対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
cdgriffith/Box#305 ·
-
[Bug] Camel killer box and box dots gives unexpected behaviour対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 30/100
cdgriffith/Box#300 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
cdgriffith/Box#298 ·
似ている issue
-
`image_generation`: `max_retries` is ignored for OpenAI-compatible providers (always 2 retries)対応中かも @ericz7900 が今日担当しました。 オープンllm translation
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
rheeloaded/paperpull#117 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
agenda-tech-brasil/agenda-tech-brasil#1619 · コメント 1 件 ·
-
process
難易度 1/5 1〜3時間 初心者へのやさしさ 76/100
pyrite-wiki/pyrite#1036 ·
メンテナーはふだん 1 日以内に返信