Hi Raymond, Thanks for the detailed explanation!
> I'm not sure what your code was doing where the bugfix would cause > breakage. If its __getitem__() override returned a meaningful value > for each element in obj.keys(), then it should have worked fine. Of > course, if it was raising an exception or triggering a side-effect, > then one could argue that the bugfix was working as intended by > allowing the subclasser to affect how the base class goes about its > business. It wasn't actually my own code, but that of a colleague. His __getitem__() override is below. It fails because __getitem__() is called with the wrong type of argument (plain int instead of a list of atoms). I'm not sure it presents a convincing use case. I would have used composition instead of inheritance in the same situation. I don't feel competent to join the discussion about the changes in the pickling behavior, but I feel quite strongly that such a change should not be introduced in a bug-fix release. Ralf def __getitem__(self, atoms): LIST = [] for atom in atoms: attr = 'index' if hasattr(atom, 'unique_index'): attr = 'unique_index' LIST.append(getattr(atom, attr)) key1 = tuple(LIST) LIST.reverse() key2 = tuple(LIST) rc = None try: rc = dict.__getitem__(self, key1) except KeyError, e: pass try: rc = dict.__getitem__(self, key2) except KeyError, e: pass return rc __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com