Could you construct some small(ish) examples and paste them here? I am
still having a hard time imagining how you implement this at runtime.
On Mon, Jan 25, 2021 at 2:54 PM Tin Tvrtković
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
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.
-- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-c...