[Python-ideas] Non-boolean return from contains (original) (raw)

Michael Foord fuzzyman at gmail.com
Tue Jul 27 18:49:12 CEST 2010


On 27 July 2010 17:42, Alexander Belopolsky <alexander.belopolsky at gmail.com>wrote:

On Tue, Jul 27, 2010 at 11:59 AM, Guido van Rossum <guido at python.org> wrote: .. >> So it doesn't help that 'in' may return something else than a bool >> because the method is called on the wrong object for your purposes. > > Well that pretty much kills the proposal. I can't believe nobody > (including myself) figured this out earlier in the thread. :-(

It may kill a use case or two, but not the proposal. In the libraries like numpy where all python containers get replaced, this is not an issue. Also this problem invites rcontains solution,

Wasn't the lack of an rcontains a problem for the web-sig guys trying to work out the bytes / strings issue?

For what it's worth I think that guido is correct that a better solution for the expression -> query problem is to introduce an expression tree, as is done for LINQ (which has been enormously popular amongst .NET developers).

All the best,

Michael Foord

but the proposal is not very attractive to begin with. IMO, operators that are not symbols such as +, - or &, but words such as 'in', 'not' or 'and' don't offer much advantage over function calls.


Python-ideas mailing list Python-ideas at python.org http://mail.python.org/mailman/listinfo/python-ideas

-- http://www.voidspace.org.uk -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-ideas/attachments/20100727/c139eebe/attachment.html>



More information about the Python-ideas mailing list