python / typing_extensions

Backported and experimental type hints for Python
Other
445 stars 109 forks source link

Fix Concatenate and Generic with ParamSpec substitution #489

Open Daraan opened 1 month ago

Daraan commented 1 month ago

this PR is is a follow up on #491 and addresses multiple locations that case problems for different situations and versions; see comments below.

Daraan commented 1 month ago

The code could be slimmed down in some cases if we introduce __typing_subst__ and __typing_prepare_subst__, was there a decision against introducing them?

AlexWaygood commented 1 month ago

The code could be slimmed down in some cases if we introduce __typing_subst__ and __typing_prepare_subst__, was there a decision against introducing them?

Not that I'm aware of. But I think functions in typing.py and elsewhere don't pay attention to these hooks on Python less than 3.11(?), so it might be less effective to add them than you might think. (I'm not confident in this opinion, definitely try it out if you think it might work!)