Finding subsets for a robust regression
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Tue Sep 30 00:17:50 EDT 2008
En Mon, 29 Sep 2008 17:04:48 -0300, <bearophileHUGS at lycos.com> escribió:
> result_x = uniques_x.keys()
> result_y = map(median, uniques_x.itervalues())
>
> I think it works because keys and values are given in the same order,
> but in real code I tend to avoid using such subtle things. Because if
> you translate that code to another language, or you use another Python
> implementation it may not work anymore, and lot of code sooner or
> later becomes translated...
At least with respect to different Python implementations, it *is* clearly
stated in the documentation that "If items(), keys(), values(),
iteritems(), iterkeys(), and itervalues() are called with no intervening
modifications to the dictionary, the lists will directly correspond."
http://docs.python.org/lib/typesmapping.html
--
Gabriel Genellina
More information about the Python-list
mailing list