Ken Jin <kenjin4...@gmail.com> added the comment:

Hi Guido, after a month of observing how people stumbled over the related 
collections.abc.Callable bugs, and experience from implementing this PEP, I 
learnt a few things which I think may interest you:

Previously it was *recommended* that everything in typing be hashable. I would 
now say it is *required*. Union uses sets to de-duplicate arguments, and 
Optional uses Union internally. Both blow up if things aren't hashable. A 
surprising number of people caught the collections.abc.Callable bug because 
Optional[Callable[.....]] failed.

Going forward, future PEPs to typing.py probably need to ensure their 
implementations are hashable, or risk not working with some of the types in the 
module itself. Alternatively, they can always change the implementations of 
Union and Optional, though I don't know if I recommend that ;).

Thanks for your time.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41559>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to