<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">Hi Raymond,<br><br>Thanks for the detailed explanation!<br><br>> I'm not sure what your code was doing where the bugfix would cause<br>> breakage. If its __getitem__() override returned a meaningful value<br>> for each element in obj.keys(), then it should have worked fine. Of<br>> course, if it was raising an exception or triggering a side-effect,<br>> then one could argue that the bugfix was working as intended by<br>> allowing the subclasser to affect how the base class goes about its<br>> business.<br><br>It wasn't actually my own code, but that of a colleague. His<br>__getitem__() override is below. It fails because __getitem__() is<br>called with the wrong type of argument (plain int instead of
a list of<br>atoms). I'm not sure it presents a convincing use case. I would have<br>used composition instead of inheritance in the same situation.<br><br>I don't feel competent to join the discussion about the changes in the<br>pickling behavior, but I feel quite strongly that such a change should<br>not be introduced in a bug-fix release.<br><br>Ralf<br><br><br> def __getitem__(self, atoms):<br> LIST = []<br> for atom in atoms:<br> attr = 'index' <br> if hasattr(atom, 'unique_index'):<br> attr = 'unique_index'<br> LIST.append(getattr(atom, attr))<br> key1 = tuple(LIST)<br> LIST.reverse() <br> key2 = tuple(LIST)<br> <br> rc = None<br> try:<br> rc =
dict.__getitem__(self, key1)<br> except KeyError, e:<br> pass<br> try:<br> rc = dict.__getitem__(self, key2)<br> except KeyError, e:<br> pass<br> return rc<br><br></div></div><br>
<hr size=1>Ahhh...imagining that irresistible "new car" smell?<br> Check out
<a href="http://us.rd.yahoo.com/evt=48245/*http://autos.yahoo.com/new_cars.html;_ylc=X3oDMTE1YW1jcXJ2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDbmV3LWNhcnM-">new cars at Yahoo! Autos.</a>
</body></html>