3 ms·
I was looking for an example of using locals() to "fill a data class from kwargs" or something similar to that. The example here doesn't use locals(). That asi
by saila 5y ago
I was looking for an example of using locals() to "fill a data class from kwargs" or something similar to that. The example here doesn't use locals().
That aside, I generally wouldn't use the kwargs approach shown in this example either. I'd use https://docs.python.org/3/library/dataclasses.html https://docs.python.org/3/library/dataclasses.html or https://www.attrs.org/ https://www.attrs.org/ instead.