Why are my queues empty even though there are items in it?

Zero Piraeus schesis at gmail.com
Tue Sep 20 21:09:12 CEST 2011


:

On 20 September 2011 14:42, MRAB <python at mrabarnett.plus.com> wrote:
> On 20/09/2011 19:13, Kayode Odeyemi wrote:
>>
>>     if item is not {} and timeout is not 0:
>
> `not {}` has the value True, so `item is not {}` means `item is True`.
> The `is` checks for identity, not equality, so this is true only if `item`
> actually has the value True or 1 (and this is an implementation-dependent
> behaviour).

Nitpick: "is not" is an operator:

>>> "foo" is not {}
True
>>> "foo" is (not {})
False

 -[]z.



More information about the Python-list mailing list