[Python-ideas] Break the dominance of boolean values in boolean context
sven at marnach.net
Thu Sep 15 14:30:44 CEST 2011
MRAB schrieb am Mi, 14. Sep 2011, um 18:19:45 +0100:
> I had a use-case recently.
> I was looking for an entry in a pseudo-dict, where the key didn't have
> to be an exact match, so I called the .get method on the pseudo-dict
> until it returned a true-ish value (the value would never be false-ish).
> I just wrote a short function to do what I wanted.
FWIW, I just came to python-ideas to propose the same change to any()
for the same use case (look-up in a pseudo dict). I needed this
several times now, and I would consider the change to any()
worthwhile. (For consistency, all() would also have to be changed,
though I didn't have a use case yet.)
More information about the Python-ideas