◐ Shell
clean mode source ↗

Prohibit Callable[[...], X] by ilevkivskyi · Pull Request #320 · python/typing

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... It really shouldn't be necessary to check this here. I think the reason may be that you're trying to make the hash key for e.g. Callable[[int, str], float] be the tuple (int, str, float) rather than just nesting the original structure. The exceptions in __getitem_inner__ seem due to this.

Or maybe you're trying to make __parameters__ a single-level tuple? But there are two exceptions for this, one for Callable[..., t] and one for Callable[[], t] (IIUC). I don't think this is really worth it...