ipython / ipython/traitlets

execution order of trait observers

オープン
#874 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
653
フォーク
217
平均マージ
2日 21時間
マージ済み PR(30日)
2

説明

its not clear to me in what order the trait observers get executed and why?
can anyone shed light on this?

```py
class Test(tr.HasTraits):
a = tr.Bool(default_value=True)
b = tr.Bool(default_value=True)
c = tr.Bool(default_value=True)

@tr.observe("a")
def _a(self, on_change):
print(f"a = {self.a}")

@tr.observe("b")
def _b(self, on_change):
print(f"b = {self.b}")

@tr.observe("c")
def _c(self, on_change):
print(f"c = {self.c}")

def __init__(self, **kwargs):
super().__init__(**kwargs)

t1 = Test(a=False, b=False, c=False)
print("---")
t2 = Test(c=False, b=False, a=False)

# b = False
# c = False
# a = False
# ---
# b = False
# c = False
# a = False
```

many thanks

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

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

調査の方向性

Start with the Test example and its tr.observe handlers, then inspect how trait initialization processes the keyword arguments and dispatches observers. Done means documenting the actual execution-order rule and why both argument orders produce the shown output.

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

評価

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

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

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