Larry Hastings <la...@hastings.org> added the comment:
> I'm not a big user of the inspect module, but I always thought that > its use was so that you could look at a function (or other object) > *produced by a 3rd party* and learn something about it. That's interesting! I always thought its main use was the opposite--it was so third parties could introspect *your* functions. Like, Pydantic examines your function's signature so it can wrap it with runtime validation. (Though in this specific case, I believe Pydantic examines __annotations__ directly.) I also dimly recall a Python library that built COM bindings around your code, but I can't find it right now. I can't remember ever writing application code that used inspect.signature() to inspect library functions--but I've certainly written library functions that used inspect.signature() to inspect application code. > Asking for the signature is one such operation, and I'd be rather > upset if I couldn't inspect the annotation if that 3rd party happened > to have added a bad string annotation. Do you think that's likely? I'd be quite surprised if it was common for third party libraries to have string annotations--either manual or using automatic stringizing--in the first place. I thought string annotations were really only used as part of type hints, and the type-hinted code was all internal code bases from large organizations, not third-party libraries. But I concede I know little about it. Following on to that, the annotations would have to be bad, which means again either someone made a typo or it was done deliberately. The latter reason would be simply obnoxious if done by a third-party library--third-party libraries should not have the circular imports problem used to justifiy such practices. I suppose third-party libraries are just as error-prone as anybody else, so if they were manually stringizing their annotations, it could happen there. Which I agree would be annoying, just like any bug in a third-party library. But I wouldn't agree this specific error is so special that we need to suppress it. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43817> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com