En Mon, 29 Sep 2008 17:04:48 -0300, <[EMAIL PROTECTED]> 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

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to