On Tue, Dec 6, 2011 at 2:48 PM, Marko Limbek <marko.lim...@valicon.net> wrote:
> Hi,
>
> Can someone please explain to me, how Python performs his random
> permutations in the keys of the dictionaries? It seems that there are some
> more or less random permutations, because the order of the variables is
> completely confused.

The order of the keys in a Python dictionary is arbitrary (like a Python set),
and furthermore differs depending on which Python implementation you
are using (traditional C Python, Jython, PyPy, etc).

You must not assume anything about the order.

> I am doing some complex statistical analysis in RPy
> (multiple correspondence analysis, factor analysis, multidimensional
> scaling) and this unordering really upsets me and makes me problems. I think
> I will need to look up exactly how Python does it in its code. Thanks for
> any suggestions!
>
> Best,
> Marko

The function sorted(...) is a quick fix for iterating over small dicts.
There are also dictionary subclasses which preserve the order.
Something like that might be more appropriate.

Peter

------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to