You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say you have several models and want to write a method that can work on several of them using duck-typing. I wanted to provide proper typing by explicitly listing the models that could be passed to the method. However, this breaks the use of the model's fields as columns.
In the example below, the error is "int" has no attribute "desc". In other words, the field is interpreted as int instead of Column[int] that one would expect. Maybe there is a better way to type this method?
Let's say you have several models and want to write a method that can work on several of them using duck-typing. I wanted to provide proper typing by explicitly listing the models that could be passed to the method. However, this breaks the use of the model's fields as columns.
In the example below, the error is
"int" has no attribute "desc"
. In other words, the field is interpreted asint
instead ofColumn[int]
that one would expect. Maybe there is a better way to type this method?Note: for a MWE, I have used
Union[MyModel, MyModel]
but it could just as well be two different models both defining thecreated
columnNote: using
Union[Model]
does not trigger the errorThe text was updated successfully, but these errors were encountered: