Title: RE: Precision Specifier


>This is pretty neat stuff.

Thanks.

>Are you aware of Python splicing? See section 3.1.2 in >          http://www.python.org/doc/tut/node5.html 

No, I wasn't, but it appears to be a similiar idea.  My notation is admitedly a little strange but I wanted to stay compatible with the current precision definition.

>The question on my mind is what do you do when the splice is out of bounds?

If a right counting (positive) index is out of bounds, it defaults to the before the first element.
If a left counting (negative) index is out of bounds, it defaults to the after the last element.
If the precision defines a range where the start is after the end it defaults to the whole string.

>For string "a"

>what is {2}, {-1}, {3,2}, {-3, -4}
a, the empty string, the empty string, the empty string

> What does {2, -4} mean?

The substring string starting from 2nd element from the right and ending before the 4th element from the left;

so for a.b.c.d  that would give c.d

>BTW, thanks for your contribution. Regards, Ceki

My pleasure.  Please let me know if you want it modified.

James

Reply via email to