ipython / ipython/traitlets

Cross-validation of dependent traits

Abierto
#389 14 comentarios 1 reacción 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
653
Forks
217
Merge medio
2 d 21 h
PR fusionados (30 d)
2

Descripción

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?

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.