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
This might be tricky, since each overload depends on the instance variables, so @overload can't be used here. This may require a small API restructure.
The text was updated successfully, but these errors were encountered:
I don't think the Python type system is flexible enough to indicate that the return value of each_record() depends on the value of the fields argument. The most sensible option is therefore to have the return value be a TypedDict that contains all possible keys, since this is the most typical usage.
It might be possible to do some hackery where search becomes a generic method using the new Py3.12 generic methods syntax. But then to get the correct functionality, the user would have to pass in the entire return type dictionary as T, which misses the user friendliness. They could pass in a union T that includes all possible fields, which becomes the keys of the return dictionary dynamically (dict[T, Any]), but then we lose the specific types of the values themselves. Also in both of these cases, Python probably can't check that the passed in T is a true subset of all the legal return values.
This might be tricky, since each overload depends on the instance variables, so
@overload
can't be used here. This may require a small API restructure.The text was updated successfully, but these errors were encountered: