[New-bugs-announce] [issue44989] Fix documentation for truth testing

Steven D'Aprano report at bugs.python.org
Mon Aug 23 23:33:20 EDT 2021


New submission from Steven D'Aprano <steve+python at pearwood.info>:

Truth testing states that "Any object can be tested for truth value" but from 3.9 onwards, doing so with NotImplemented is deprecated and will be made a TypeError.

https://docs.python.org/3/library/stdtypes.html#truth-value-testing

It is also not true for third-party objects such as numpy arrays (which raise ValueError) and pandas dataframes.

I think that truth testing should have been considered a fundamental operation that (in the absence of bugs) always succeeds, but #35712 says different. Not that I'm bitter *wink*

In any case, at the very least the exception for NotImplemented should be documented.

----------
assignee: docs at python
components: Documentation
messages: 400196
nosy: docs at python, steven.daprano
priority: normal
severity: normal
status: open
title: Fix documentation for truth testing
versions: Python 3.10, Python 3.11, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44989>
_______________________________________


More information about the New-bugs-announce mailing list