On Sep 6, 12:47 am, Dr Mephesto <[EMAIL PROTECTED]> wrote:
>
> I need some real speed! a database is waaay to slow for the algorithm
> im using. and because the sublists are of varying size, i dont think I
> can use an array...- Hide quoted text -
>
> - Show quoted text -
How about a defaultdict approach?
from collections import defaultdict
dataArray = defaultdict(lambda : [[],[],[],[],[]])
dataArray[1001][3].append('x')
dataArray[42000][2].append('y')
for k in sorted(dataArray.keys()):
print "%6d : %s" % (k,dataArray[k])
prints:
1001 : [[], [], [], ['x'], []]
42000 : [[], [], ['y'], [], []]
-- Paul
--
http://mail.python.org/mailman/listinfo/python-list