"Dinesh B Vadhia" <dineshbvad...@hotmail.com> wrote

Have a large number (> 1bn) of integer co-ordinates (i, j).
I want to create (j, i) with j ordered and i unordered ie.

I've tried the dictionary route and it works perfectly for small set of
co-ordinate pairs but not for large sets as it hits memory capacity.

One option is to load them into a database and use its sort facilities.

Another is to use the old mainframe approach of batching
the data and sorting each batch. Its then a relatively easy job
to merge the sorted batches back into a single file without
ever holding the whole thing in memory at once. But its not fast...

HTH,

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to