
On Sun, Aug 22, 2021 at 07:01:28PM +0300, Serhiy Storchaka wrote:
(len(collection) == 0) is True
Ha ha, yes, very good, you got me. But the trouble is, if you don't trust the truth value of the predicate, it is hard to know when to stop: len(collection) == 0 (len(collection) == 0) is True ((len(collection) == 0) is True) is True (((len(collection) == 0) is True) is True) is True ((((len(collection) == 0) is True) is True)) is True # ... *wink* MRAB and Ricky: `__builtins__` is a CPython implementation detail and is reserved for the interpreter's private use. Other implementations may not even have it. The right way to write your code should be import builtins builtins.bool((builtins.len(collection) == 0) is True) is True -- Steve