Message391989
I agree with Guido that it's better to design inspect.signature to not throw an error for annotations that don't eval() cleanly.
I use inspect.signature for getting information about callables (third-party and first-party) in my type checker: https://github.com/quora/pyanalyze/blob/master/pyanalyze/arg_spec.py#L436.
In that context, I'd much rather get string annotations that I can process myself later than get an exception if the annotations aren't valid at runtime. In the former case I can still get useful information out of the signature even if I don't know how to process some annotations. For example, I'll still know what parameters exist even if I don't know what their types are. In the latter case, I don't get any useful signature data. |
|
Date |
User |
Action |
Args |
2021-04-26 21:43:27 | JelleZijlstra | set | recipients:
+ JelleZijlstra, gvanrossum, barry, larry, eric.smith, methane, lukasz.langa, xtreak, kj |
2021-04-26 21:43:27 | JelleZijlstra | set | messageid: <1619473407.43.0.867722510758.issue43817@roundup.psfhosted.org> |
2021-04-26 21:43:27 | JelleZijlstra | link | issue43817 messages |
2021-04-26 21:43:27 | JelleZijlstra | create | |
|