Hi Bram and others, I am wondering if its just me who feels that the restrictions placed on some of the List functions are not such a great idea.
1. a[:5] in python returns the first five elements of a if len(a) > 5 or all elements if len(a) < 5. In VimL, a[:4] is an error if len(a) < 5. Right now, we have to do something like: a[:(min(5,len(a))-1)] to get the same behavior. It seems to be a common enough behavior to want to get the first so many elements (or less) of a list that I have found myself doing this at least 5-6 times already... Python seems to have gotten this right IMHO. 2. In VimL, a[N:M] is an error if M<N-1 (alghough its not when M=N-1!). In Python, this is just an empty list. This too has to be accounted for using verbose min() statements. What is the motivation for this restriction? Is it an implementation issue? In fact, why not model VimL's lists on Python's lists? Srinath