True == 1 weirdness
random832 at fastmail.com
Wed Sep 16 16:03:50 CEST 2015
On Wed, Sep 16, 2015, at 09:05, Chris Angelico wrote:
> My view is that they should remain in the language, but that
> dissimilar comparisons should raise linter warnings. I can't imagine a
> sane reason for chaining 'in' and equality like that (since the RHS of
> 'in' will be a container, and if you're testing the whole container
> for equality, you probably don't care about one member in it), but for
> language consistency, it's good to support it.
> Chained comparisons of the same type are a great feature:
Do chained "in" comparisons ever really make sense, even when they're
all the same type?
I mean, I suppose 1 in (1, 2) in ((1, 2), (3, 4)) is technically true,
but how useful is it really?
More information about the Python-list