- Notifications
You must be signed in to change notification settings - Fork673
Using TypedDict to type check **kwargs#3123
-
Currently the most of the methods that have an underlying HTTP request takes a However, because they are using To type hint https://peps.python.org/pep-0692/ https://docs.python.org/3/library/typing.html#typing.Unpack One of the issues implementing this can be that all unused |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 1 comment 3 replies
-
I'm a bit torn on this, because being able to provide API parameters for arbitrary endpoints directly as function arguments makes this library more convenient to use and the user code more pythonic. On the other hand I assume without moving to |
BetaWas this translation helpful?Give feedback.
All reactions
-
The TypedDict means a fixed keys. I believe it is impossible to have a TypedDict where only some keys have fixed keys and typed values.
Isn't it more explicit to have a dedicated keyword argument to add extra HTTP query instead of implicitly converting extra arguments. |
BetaWas this translation helpful?Give feedback.
All reactions
-
That's true. My thinking was more that for the higher-level functions, most of the time the query parameters are the only arguments users need to care about, and it's the other arguments that are more like extra args. So it feels more natural (to me) to use them like that as arguments rather than nesting them in a dict. For some custom methods/endpoints for example, we even expose them directly. But maybe we should think about having a dedicated object that we can validate a bit in the long run. I think@JohnVillalovos had some similar ideas in the past regarding this, though. |
BetaWas this translation helpful?Give feedback.
All reactions
-
It should be possible to have common and documented HTTP query parameters to still have named keys in the TypedDict. For example, |
BetaWas this translation helpful?Give feedback.