"Alexander R. Pruss" <[EMAIL PROTECTED]> asked > I am looking at the (PyPlucker/Writer.py) fragment: > > for (url, doc) in collection.items(): > self._get_id_for_doc(doc) > > _get_id_for_doc assigns record numbers sequentially as it is > called. What I guess I don't understand is how collection.items() > gets to have the order it does.
It is essentially random. collection is a "dictionary", which is basically an unordered set of key->value mappings. collection.items() will get all the mappings, but the order may well depend on which memory locations plucker happened to get for this run. If you need to keep the original order, you'll have to use an ordered collection, like a list of tuples. But then you have to either rewrite or support the places that really do assume they have a dictionary. It may be easier to just reuse some other code from the vaults of Parnassus, if you are OK with the copyright. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/161403 (and http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/161403/index_txt ) provide an example ordered dictionary. I couldn't find any explicit copyright information, but you could email the author. -jJ _______________________________________________ plucker-dev mailing list [EMAIL PROTECTED] http://lists.rubberchicken.org/mailman/listinfo/plucker-dev
