I think you are getting a bit tangled up in the distinction between what I
call "data" and "code":

dicts are data
dataclasses are code.

Granted, in Python this line can be blurry, but I think it's helpful to
think about it that way.

Thinking of it this way,  dataclasses.asdict() is converting code to data,
and so it makes sense to convert it completely to data. In many contexts
where you want a dict, a custom dataclass (or anything other custom class)
as values wouldn't really make sense (imagine passing it into the json lib,
for instance).

All that being said, an option to do a "shallow" or "deep" conversion in
asdict() makes sense to me.

-CHB

-- 
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/KXWERYNOIJCGU6JCIOK3KM7MVUWYMJG6/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to