Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

I can create a method in a box that overwrite a key

オープン
#222 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
38/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
tooling

調査の方向性

まず、Boxを使ってサブクラスの例を再現し、競合する"print"キーについてドットアクセスとブラケットアクセスを比較します。payloadには実装ファイルもテストも指定されていません。Boxの属性検索とキー検索の動作を追跡し、そのうえで意図された結果が警告なのか、文書化された動作なのかを確認します。

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

説明

documentation

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 はありません

環境構築

はじめの一歩

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

cdgriffith/Box のほかの issue

cdgriffith/Box の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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