On 11-05-2012 22:29, Jonathan M Davis wrote:
On Friday, May 11, 2012 21:02:46 Alex Rønne Petersen wrote:
On 11-05-2012 20:34, Mehrdad wrote:
On Friday, 11 May 2012 at 18:25:17 UTC, Jonathan M Davis wrote:
Actually, that is a WAT even for somebody coming from C/C++.

Really? That's pretty much exactly what I would have expected, and it
would
really suck if it returned a bool. It's like what you get with find on
std::map, only it's a pointer instead of an iterator.

- Jonathan M Davis

Again, try to see it from the perspective of a Python user, not a
C++ user.

Speaking of which, 'in' on arrays.........

*hint hint*

Except that it would break the generally expected algoritmic complexity of in,
so it'll never happen ( O(n) for arrays, whereas the worst case that would be
acceptable would be O(lg n) - e.g. what a binary tree could achieve).

- Jonathan M Davis

'in' isn't useful in generic code. How it's defined (return type and parameter type) depends entirely on the type being operated on (who says it's an AA? Or a map-like type at all?), so it cannot be used generically in any sensible way.

As such, maintaining any specific algorithmic complexity for it serves no purpose IMHO.

--
- Alex

Reply via email to