This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Mismatching documentation <=> behaviour for typing.Any
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder: _TypeAlias: Discrepancy between docstring and behavior
View: 25830
Assigned To: Nosy List: abarry, berker.peksag
Priority: normal Keywords:

Created on 2015-11-17 18:36 by abarry, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg254811 - (view) Author: Anilyka Barry (abarry) * (Python triager) Date: 2015-11-17 18:36
The docstring for typing.Any specifically says "- Any object is an instance of Any."; in practice however it's not actually the case, as isinstance(x, Any) raises a TypeError.

AnyMeta makes this behaviour seem intentional, however the official documentation seems to be a bit vague on that one too -- https://docs.python.org/3/library/typing.html#the-any-type makes no mention of 'isinstance', but just the next paragraph mirrors the docstring, in 'Any object is an instance of Any'.

I personally believe this is a behaviour error and the docs are correct, as that seems the most logical conclusion. Should this be fixed for 3.5.1?
msg265712 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-05-16 16:43
This is basically a duplicate of issue 25830. We can update the docstring of Any once https://github.com/python/typing/issues/136 is solved.
History
Date User Action Args
2022-04-11 14:58:23adminsetgithub: 69836
2016-05-16 16:43:08berker.peksagsetstatus: open -> closed

superseder: _TypeAlias: Discrepancy between docstring and behavior
nosy: + berker.peksag

messages: + msg265712
type: behavior
resolution: duplicate
stage: resolved
2015-11-17 18:36:23abarrycreate