Looking through docs, I was unable to tease out whether there's a
prescribed behavior for the results of defining a dictionary with the
same keys multiple times

  d = {
     "a": 0,
     "a": 1,
     "a": 2,
      }

In my limited testing, it appears to always take the last one,
resulting in

  {"a": 2}

as if it iterated over the items, adding them to the dict, tromping
atop any previous matching keys in code-order.

Is this guaranteed by the language spec, or do I have a long weekend
of data-cleaning ahead of me?  (this comes from an unwitting coworker
creating such dicts that mung customer data, and I am trying to
determine the extent of the damage...whether it's a consistent issue
or is at the arbitrary whims of the parser)

Thanks,

-tkc




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

Reply via email to