Hello. I'm interested in this since my library, cattrs, supports this use case and I have users raising issues about this missing functionality. (Case in point, https://github.com/Tinche/cattrs/issues/111) On Mon, Jan 25, 2021 at 10:34 PM Guido van Rossum <guido@python.org> wrote:
First impressions:
I noticed that none of your examples actually show how you would write the body of a function like isassignable(). Are you assuming that those implementations just introspect the runtime representation?
In cattrs it's complicated, using the type passed in and a system of direct matching, singledispatch and predicates to choose how to handle the type. cattrs needs to support arbitrary type forms though, like Tuple[Optional[DateTime], ObjectId] (where (pendulum.)DateTime and (bson.)ObjectId are non-stdlib classes), hence the complexity.