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 serhiy.storchaka
Recipients dilyan.palauzov, serhiy.storchaka
Date 2017-11-30.12:10:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1512043817.71.0.213398074469.issue32180@psf.upfronthosting.co.za>
In-reply-to
Content
The cause of len() been faster than bool() is the same as why repr() is faster than str(). [1] len() and repr() are functions that just call corresponding slots, while bool() and str() are constructors.

In most cases you shouldn't use `bool(obj)` or `len(obj) > 0`. Instead use just `obj` in conditions.

If you can provide a patch that speeds up constructions of simple class instances, please open a pull request on GitHub. Otherwise this issue will be closed.

[1] https://stackoverflow.com/questions/45376719/why-is-reprint-faster-than-strint
History
Date User Action Args
2017-11-30 12:10:17serhiy.storchakasetrecipients: + serhiy.storchaka, dilyan.palauzov
2017-11-30 12:10:17serhiy.storchakasetmessageid: <1512043817.71.0.213398074469.issue32180@psf.upfronthosting.co.za>
2017-11-30 12:10:17serhiy.storchakalinkissue32180 messages
2017-11-30 12:10:17serhiy.storchakacreate