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 xtreak
Recipients porton, rhettinger, xtreak
Date 2018-07-21.16:18:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1532189896.3.0.56676864532.issue34180@psf.upfronthosting.co.za>
In-reply-to
Content
Relevant SO answer : https://stackoverflow.com/a/41861322/2610955

Ref : https://docs.python.org/3/reference/datamodel.html#object.__bool__

> If a class defines neither __len__() nor __bool__(), all its instances are considered true.

I don't know why it's not implemented and the SO answer comments has some discussion. Maybe this can be clarified in the doc.

➜  cpython git:(master) rlwrap ./python
Python 3.8.0a0 (heads/master:56868f9, Jul 21 2018, 14:28:31)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from queue import PriorityQueue
>>> len(PriorityQueue([1]))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: object of type 'PriorityQueue' has no len()


Thanks
History
Date User Action Args
2018-07-21 16:18:16xtreaksetrecipients: + xtreak, rhettinger, porton
2018-07-21 16:18:16xtreaksetmessageid: <1532189896.3.0.56676864532.issue34180@psf.upfronthosting.co.za>
2018-07-21 16:18:16xtreaklinkissue34180 messages
2018-07-21 16:18:16xtreakcreate