-
Notifications
You must be signed in to change notification settings - Fork 27
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
Always require optional field in python target #70
Comments
Should we treat it as a bug? I'm not sure. Think of the following example:
It consists of two required fields and two optional fields, and they appear by turns. So should it be compiled to |
There could be some ways. One way is making |
Now it becomes harder to be keyword-only than before, since now Python target has Python 2 generator as well. Whereas Python 3 has a operator for keyword-only parameters (PEP 3102), Python 2 does not. In order to implement keyword-only parameters in Python 2, we need some tricks: def __init__(self, **kwargs):
invalid_params = frozenset(kwargs) - {'a', 'b', 'c', 'd'}
if invalid_params:
raise TypeError('unexpected keywords: ' + ', '.join(invalid_params))
... |
👀 |
Above
foo
record compiled toIt requires
optional_data
as a argument to initiate classFoo
, althoughoptional_data
is optional.The text was updated successfully, but these errors were encountered: