On Oct 17, 2007, at 6:28 PM, Paul McNett wrote:

> I guess what gets me about VFP arrays is that there isn't such a thing
> as an empty one. When you initialize an array, it comes with a single
> element, initialized to .F. So when you go to populate it, you have to
> have special code to either not redimension it for the first  
> element, or
> to remove the bogus extra element after you are done populating.
>
> Other than that, an array index is fundamentally an offset from the
> beginning. 0-based preserves that relationship, so that the first
> element has no offset, the second element is offset by 1, etc.
>
> Do you commonly find yourself writing code like:
>
>    alen(aTemp, 1) - 1
>
> ? If so, that indicates that 0-based would be better.

        Actually, "zero-based" doesn't mean that it can have zero elements;  
it only means that you reference the first element by 0 instead of 1.  
All Python sequences can be empty.

        The index of a sequence (list, tuple, array) is thought of as either  
the absolute position of the element, or the offset from the  
beginning. The former is 1-based, since the first position is #1, the  
second is #2, etc.; the latter is 0-based, since the first position  
is at the beginning and thus not offset (offset=0), the second  
element is offset by 1 from the beginning, etc.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to