New submission from Steven D'Aprano <steve+pyt...@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@python components: Documentation messages: 400196 nosy: docs@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 <rep...@bugs.python.org> <https://bugs.python.org/issue44989> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com