[Python-ideas] Non-boolean return from __contains__
masklinn at masklinn.net
Mon Jul 26 07:50:07 CEST 2010
On 2010-07-26, at 05:07 , Guido van Rossum wrote:
>> A lot of code for containers or that uses containers implicitly
>> expects simple invariants to hold:
>> for x in container:
>> assert x in container
> Yeah, a lot of code using comparisons also breaks when comparisons
> don't return bools. It's a specialized use, but I don't see it as
> OTOH the real solution would be something like LINQ in C#
Most of LINQ itself (the LINQ library, as opposed to the query syntaxes which are solely syntactic sugar and statically compiled into LINQ method calls) can already be implemented in Python.
The things that might be missing are *some* LINQ-supporting features. Likely expression trees, maybe (but probably not) less limited and terser lambdas.
More information about the Python-ideas