FWIW, I actually think strings shouldn't define indexing at all: they should only define iteration.
-- John On Oct 6, 2014, at 10:10 AM, John Myles White <[email protected]> wrote: > It's dangerous because strings aren't arrays of bytes: they're sequences of > codepoints. So you can't safely modify a string (which is part of the reason > they're immutable) without rewriting the whole string and you can't find a > character in a sequence without reading the whole sequence. > > Another way to say it: strings are iterables, but they are definitely not > arrays. > > -- John > > On Oct 6, 2014, at 9:37 AM, Daniel Høegh <[email protected]> wrote: > >> I know it's slow but is it considered dangerous then please enlighten me. >> Can it not be acceptable to some extend to sacrifice speed to simplicity, >> people will do this trick or maybe worse things. >
