Python Forum
issubclass() not as documented
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
issubclass() not as documented
#18
I agree with Skaperen here. The docs clearly state that the only result of running issubclass() is either True, or an exception.

Looking at tests to see how internals to Python core work shouldn't (ever) be needed to understand how to use Python, or any library for that matter.

Looking at the source of Python could involve looking at C code, which isn't a viable option for everyone writing Python.

This is a very clear case of the documentation not matching current functionality. Since fixing the bug would involve breaking changes (and returning False to a function who's name clearly indicates it returns a bool), the docs should be updated to more clearly indicate what's actually returned.

Quote:Return True if class is a subclass (direct, indirect or virtual) of classinfo. A class is considered a subclass of itself. classinfo may be a tuple of class objects, in which case every entry in classinfo will be checked. In any other case, a TypeError exception is raised.
I don't even see this as a discussion. There's no argument about ambiguous docs, they're just incorrect. Either True is returned, or a TypeError is raised. Any other functionality (such as returning False) is undefined behavior.
Reply


Messages In This Thread
issubclass() not as documented - by Skaperen - Mar-06-2021, 11:40 PM
RE: issubclass() not as documented - by ndc85430 - Mar-07-2021, 06:57 AM
RE: issubclass() not as documented - by Gribouillis - Mar-07-2021, 09:15 AM
RE: issubclass() not as documented - by Skaperen - Mar-07-2021, 08:53 PM
RE: issubclass() not as documented - by Skaperen - Mar-07-2021, 08:57 PM
RE: issubclass() not as documented - by snippsat - Mar-07-2021, 11:29 PM
RE: issubclass() not as documented - by Skaperen - Mar-08-2021, 12:51 AM
RE: issubclass() not as documented - by ndc85430 - Mar-08-2021, 06:28 AM
RE: issubclass() not as documented - by Skaperen - Mar-08-2021, 08:10 AM
RE: issubclass() not as documented - by stranac - Mar-08-2021, 06:36 AM
RE: issubclass() not as documented - by Skaperen - Mar-08-2021, 08:13 AM
RE: issubclass() not as documented - by stranac - Mar-08-2021, 12:29 PM
RE: issubclass() not as documented - by perfringo - Mar-08-2021, 02:39 PM
RE: issubclass() not as documented - by ndc85430 - Mar-09-2021, 06:53 AM
RE: issubclass() not as documented - by Skaperen - Mar-11-2021, 12:41 AM
RE: issubclass() not as documented - by ndc85430 - Mar-11-2021, 03:08 AM
RE: issubclass() not as documented - by Skaperen - Mar-11-2021, 03:42 AM
RE: issubclass() not as documented - by nilamo - Mar-11-2021, 07:50 PM
RE: issubclass() not as documented - by Skaperen - Mar-14-2021, 01:34 AM
RE: issubclass() not as documented - by nilamo - Mar-15-2021, 04:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  where is this documented? Skaperen 8 4,707 Feb-20-2018, 03:31 AM
Last Post: Skaperen
  format spec %b is documented but does not work Skaperen 13 10,744 Jul-31-2017, 09:21 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020