[issue43817] Add typing.get_annotations()

2021-04-16 Thread Guido van Rossum
Guido van Rossum added the comment: Putting it in inspect makes sense then. -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue43817] Add typing.get_annotations()

2021-04-16 Thread Larry Hastings
Larry Hastings added the comment: Assuming this function is added for Python 3.10, I propose that uses of typing.get_type_hints() in the standard library that aren't specifically dealing with type hints should change to calling this function instead. I currently know of two sites: * ins

[issue43817] Add typing.get_annotations()

2021-04-16 Thread Guido van Rossum
Guido van Rossum added the comment: Also, for crosslinking, see issue43463. -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue43817] Add typing.get_annotations()

2021-04-16 Thread Larry Hastings
Larry Hastings added the comment: > Should this feature implemented in typing module? How about inspect module? That's a reasonable idea. Part of the reasoning behind putting it in the typing module was to share its implementation with typing.get_type_hints(). However, I was reading the sou

[issue43817] Add typing.get_annotations()

2021-04-16 Thread Inada Naoki
Inada Naoki added the comment: Should this feature implemented in typing module? How about inspect module? Additionally, how about adding `get_annotation_str()`, which returns str always? Some use cases (e.g. `help(f)`) need just string. I want to skip eval() in it. -- nosy: +methane

[issue43817] Add typing.get_annotations()

2021-04-15 Thread Barry A. Warsaw
Change by Barry A. Warsaw : -- nosy: +barry ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue43817] Add typing.get_annotations()

2021-04-13 Thread Ken Jin
Change by Ken Jin : -- nosy: +kj ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mail

[issue43817] Add typing.get_annotations()

2021-04-12 Thread Jelle Zijlstra
Change by Jelle Zijlstra : -- nosy: +Jelle Zijlstra ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue43817] Add typing.get_annotations()

2021-04-12 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue43817] Add typing.get_annotations()

2021-04-12 Thread Larry Hastings
Larry Hastings added the comment: > I'd say just submit the PR. Shouldn't be problematic. Okey-doke, I can do it. Though I have plenty to do at the moment, though, so it wouldn't be this week. Is there anybody who would *enjoy* taking this on, who we could farm it out to? If not, that's n

[issue43817] Add typing.get_annotations()

2021-04-12 Thread Guido van Rossum
Guido van Rossum added the comment: I'd say just submit the PR. Shouldn't be problematic. (Have you decided what to do if the eval() fails?) -- ___ Python tracker ___

[issue43817] Add typing.get_annotations()

2021-04-12 Thread Larry Hastings
Larry Hastings added the comment: To be honest, I'm not 100% sure. But I observe that typing.get_type_hints() is about fifty lines of code, and very few of them are the opinionated lines I want to avoid. Some things typing.get_type_hints() seems to do for you: * Work around the "classes inh

[issue43817] Add typing.get_annotations()

2021-04-12 Thread Guido van Rossum
Guido van Rossum added the comment: It's fair that get_type_hints() does too much. But what does your proposed function do besides this? {k: eval(v) for k, b in x.__annotations__.items()} ? -- ___ Python tracker

[issue43817] Add typing.get_annotations()

2021-04-12 Thread Larry Hastings
Larry Hastings added the comment: (realized mid-issue-creation that it should have a different name) -- title: Add typing.eval_annotations() -> Add typing.get_annotations() ___ Python tracker ___