Open kdienes opened 2 years ago
Do you know how to get DataClasses to reject non keyword arguments?
I could come up with the same inheritance hacks that you can, but the easier answer probably comes with 3.10:
kw_only: If true (the default value is False), then all fields will be marked as keyword-only. If a field is marked as keyword-only, then the only affect is that the init() parameter generated from a keyword-only field must be specified with a keyword when init() is called. There is no effect on any other aspect of dataclasses. See the parameter glossary entry for details. Also see the KW_ONLY section.
New in version 3.10.
This leads to:
File "/usr/lib/python3/dist-packages/mako/runtime.py", line 947, in _exectemplate
callable(context, *args, **kwargs)
File "network_base_mako", line 63, in render_body
File "default_network_mako", line 74, in render_network
AttributeError: 'NoneType' object has no attribute 'prefixlen'
which is correct but a little surprising since it looks like the first arg to V4Config is going to go into 'network' since that's the first field in V4Config.
But actually it goes into dns_servers because of L3ConfigMixin
I'd love to see it reject the bare arg and/or give a better error check from or before the template