On Tue, Dec 27, 2011 at 2:42 PM, Dmitri Snytkine <
dsnytk...@ultralogistics.com> wrote:

> Odd how substring can be used as index of string.


oh, I see where the confusion comes from.
the reason why "foobar"["foo"] returns 'f' isn't that "foo" is a substring
of "foobar", but that "foo" will be casted to int, which will result in
"foobar"[0], which in turn will result in 'f'
and "foobar"["3 apples"] would return 'b' for example.
it's an unexpected behavior for many people, but it is how it works and we
even documented this.
as I mentioned in my previous mail, we will try to make this a little bit
more noisy, as this can lead to hard to spot bugs.

-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu

Reply via email to