ipython / ipython/traitlets

Cross-validation of dependent traits

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

説明

Suppose I have an object with traits 'a', 'b', and 'c', with the constraints that a>b>c and default values a=1, b=10, c=100. I'd like to write a validator that checks this constraint, such that I can assign all three values at once to get a new consistent state (either on creation, like MyObject(a=5, b=6, c=7). How would I write such a validator?

If it's not possible, would it be possible to include in the proposal argument to a validator the new values of any other traits in the same assignment, so I can compare against what the object state will be instead of what it currently is?

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

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

評価

この issue はまだ評価されていません。

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

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