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
It would be useful to be able to parse a list of input, while knowing some of them will not conform to a schema, for example, given a schema:
classS(Struct):
a: intb: str
and the input [{"a": 1, "b": "foo"}, {"c": 2}, {"a": 3, "b": "bar"}], we want to be able to extract the first and third elements, even though the second is invalid. A bonus would be to be able to extract the errors that occurred. my current solution for this is as follows:
It would be useful to be able to parse a list of input, while knowing some of them will not conform to a schema, for example, given a schema:
and the input
[{"a": 1, "b": "foo"}, {"c": 2}, {"a": 3, "b": "bar"}]
, we want to be able to extract the first and third elements, even though the second is invalid. A bonus would be to be able to extract the errors that occurred. my current solution for this is as follows:however, this solution is both cumbersome and is between x4 and x10 slower than parsing a
list[S]
, maybe a lower-level solution will be fasterThe text was updated successfully, but these errors were encountered: