Issue 1323

BlazingWhitester max.klyga at gmail.com
Sat Jan 8 15:44:30 PST 2011


On 2011-01-09 01:20:17 +0200, bearophile said:

> Andrei has recently closed issue 1323, it's a small but very useful 
> feature, so I suggest some public discussion:
> http://d.puremagic.com/issues/show_bug.cgi?id=1323
> 
> Lines like this is present thousands of time in my Python code:
> n in [1, 2, 3]
> c in "hello"
> "llo" in some_string
> 
> Bye,
> bearophile

This feature was discussed before.
If 'in' operator was overladable, users would expect it to have some 
known complexity.

Having sintactic sugar for some operation means that it is supposed to 
be used widely, and using O(n) operations all over the place is not a 
good idea.

Also, IMO, it has no real advantage, why not use std.algorithm.find instead ?



More information about the Digitalmars-d mailing list