New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
be carefull with **kwargs call #1625
Comments
I do not understand this issue, this is a common Python problem, I do not think we can fix it, and it would be an overkill handling this |
Well we can def'ly fixed it. I actually think this is one of the major blocker of Jina this kwargs things since we use it everywhere. To me if we don't tackle this from the start we create a lot of pain for users. The whole pydantic / FastAPI idea is that we should be able to catch this kind of typo |
what does FastAPI and Pydantic have to do with |
They basically never expose |
But this is just what they do, it is not that it is their main value proposition |
Context
we need to be carefull when using
**kwargs
in a function signature.We should always raised an expectation when too many kwargs are passed.
Example:
if I define
def f(hello='hello', **kwargs)
but I call the function withf(heello='hey')
it will not be called at runtime and it the typo will create confusion.We should avoid this in a systematic manner maybe with a decorator
Context
**kwargs
usage and verify that we handle it proprelyThe text was updated successfully, but these errors were encountered: