classification
Title: _TypeAlias: Discrepancy between docstring and behavior
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: berker.peksag, flying sheep, gvanrossum, levkivskyi
Priority: normal Keywords:

Created on 2015-12-09 11:57 by flying sheep, last changed 2016-09-27 22:26 by gvanrossum. This issue is now closed.

Messages (4)
msg256154 - (view) Author: (flying sheep) * Date: 2015-12-09 11:57
_TypeAlias claims in its docstring that “It can be used in instance and subclass checks”, yet promptly contradicts itself if you try it: “Type aliases cannot be used with isinstance().”

it would be useful to either document (and therefore bless) type_impl, or make it actually work with isinstance (probably by delegating to type_impl)
msg258776 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-01-21 22:36
Looks like the docstring is a bit misleading. ``isinstance(m, Match)`` behavior is already tested in the test suite: https://hg.python.org/cpython/file/default/Lib/test/test_typing.py#l1297
msg258778 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2016-01-21 23:25
Actually isinstance() shouldn't be supported by most things in typing.py
(except for those that mimic existing collection ABCs). Even issubclass()
should be taken out according to the BDFL-delegate for PEP 484. See
https://github.com/ambv/typehinting/issues/136
msg277560 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2016-09-27 22:26
Fixed by 09cc43df4509.
History
Date User Action Args
2016-09-27 22:26:00gvanrossumsetstatus: open -> closed
resolution: fixed
messages: + msg277560
2016-06-30 22:05:41levkivskyisetnosy: + levkivskyi
2016-05-16 16:43:08berker.peksaglinkissue25650 superseder
2016-01-21 23:25:22gvanrossumsetmessages: + msg258778
2016-01-21 22:36:31berker.peksagsetnosy: + berker.peksag, gvanrossum
messages: + msg258776
2015-12-09 11:57:32flying sheepcreate