Paul Newton wrote:

> How/why are 0-based arrays superior to 1-based arrays ?


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.

On the other hand, in Python I sometimes need the natural index, most 
likely to display to the user, so I end up doing:

   idx + 1

-- 
pkm ~ http://paulmcnett.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