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.

Author gvanrossum
Recipients gvanrossum, philiprowlands, rhettinger, scoder, serhiy.storchaka
Date 2019-12-01.19:20:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1575228028.96.0.990212152079.issue38941@roundup.psfhosted.org>
In-reply-to
Content
I'm +1 on adding the deprecation and changing it to an error in the future.

I think it's an anti-pattern that objects with complex behavior that includes some sequence behavior allow the fallback behavior for checking the empty sequence. I recall being bitten by this nearly 20 years ago (at Zope) when some database class used this pattern -- somehow the app ended up thinking there was no database at all when in fact there was one but it was empty, and it reinitialized the database with bad results.

The fallback from truth testing to __len__() is built into the language and cannot be changed, but we *can* override __bool__() to raise an exception, and I think that's what we should do. (Clearly that's also what we were planning to do, hence the warning in the Python version.)
History
Date User Action Args
2019-12-01 19:20:29gvanrossumsetrecipients: + gvanrossum, rhettinger, scoder, serhiy.storchaka, philiprowlands
2019-12-01 19:20:28gvanrossumsetmessageid: <1575228028.96.0.990212152079.issue38941@roundup.psfhosted.org>
2019-12-01 19:20:28gvanrossumlinkissue38941 messages
2019-12-01 19:20:28gvanrossumcreate