Can you give me a pointer to a previous hashing?  (Which is all I really wanted to begin with, it seems like something that must have been discussed previously).

Thanks,
     Caleb




On Thu, Mar 18, 2021, 11:29 AM Guido van Rossum <guido@python.org> wrote:
Sorry, I don't have the bandwidth to rehash this. One thing I recall is that the bool type is final at runtime, but that's not the only reason.

On Thu, Mar 18, 2021 at 10:22 AM Jake Bailey via Typing-sig <typing-sig@python.org> wrote:
If all TypeGuards are assignable to bool, but bool is not assignable to any TypeGuard, and at runtime are still always bool (so an "implicit subtype", as I've seen spelled out elsewhere), then the closest analog in any currently available system is int/float, since one can use an in where float is required and it's legal. I can't attach any type information in this way, but I'm trying to work with what I have.

from typing import Any, Callable, overload

Bool = float
TypeGuard = int

@overload
def func(x: Callable[..., TypeGuard]) -> str: ...
@overload
def func(x: Callable[..., Bool]) -> int: ...
def func(x: Any) -> Any: ...

Pyright in strict mode reports: Overload 1 for "func" overlaps overload 2 and returns an incompatible type

mypy says nothing, due to https://github.com/python/mypy/issues/10143. Perhaps that's some of the source as to why these examples are not working.

I'm going to defer explaining this requirement to either Eric or Guido; it's clear my explanation of this based on what I got through the grapevine isn't holding up to a pile-on.
_______________________________________________
Typing-sig mailing list -- typing-sig@python.org
To unsubscribe send an email to typing-sig-leave@python.org
https://mail.python.org/mailman3/lists/typing-sig.python.org/
Member address: guido@python.org


--
--Guido van Rossum (python.org/~guido)
_______________________________________________
Typing-sig mailing list -- typing-sig@python.org
To unsubscribe send an email to typing-sig-leave@python.org
https://mail.python.org/mailman3/lists/typing-sig.python.org/
Member address: donovick@cs.stanford.edu