Hi Brice
Good comment. I liked it. Not badly off-topic I think, because it
looks to be an interesting work-around for the original problem. You
wrote
> But for dataclasses, I'd find it quite useful to have
> {**my_data_class}
> be a shortcut to
> {**dataclasses.asdict(my_data_class)}
How about writing
fn( ** stst( data_class_obj ) )
where stst() does whatever it is you consider to be the right thing.
My suggestion would be something like
def stst(obj):
method = getattr(obj, '__stst')
if method:
return method()
else:
return obj
And then it's your responsibility to add an '__stst' attribute to your
data classes.
--
Jonathan
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/