On Sep 17, 2008, at 10:28 AM, Simon King wrote: > > Dear Team, > > suppose one has data that are addressed by a pair of integers i,j. > Suppose further that the occuring values of i form a range 0,...,n. > The occuring values of j, in contrast, do not come in a range. > > How should these data be stored? > 1. As a list L of dictionaries, so that you can get the data by L[i] > [j], or > 2. As a dictionary D whose keys are pairs, so that you get the data by > D[(i,j)] > > Which version is faster?
A dict of pairs should be faster. Note that you can write D[i,j] as shorthand for D[(i,j)]. - Robert --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
