<br><br><div><span class="gmail_quote">On 9/20/06, <b class="gmail_sendername">Thomas Heller</b> <<a href="mailto:theller@python.net">theller@python.net</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Brett Cannon schrieb:<br>> On 9/20/06, Thomas Heller <<a href="mailto:theller@python.net">theller@python.net</a>> wrote:<br>>><br>>> Is it an oversight that exception instances do no longer support<br>
>> slicing in Python 2.5?<br>>><br>>> This code works in 2.4, but no longer in 2.5:<br>>><br>>> try:<br>>> open("", "r")<br>>> except IOError, details:<br>
>> print details[:]<br>><br>><br>> Technically, yes. There is no entry in the sq_slice field for the<br>> PySequenceMethods struct. Although you can get to the list of arguments by<br>> going through the 'args' attribute if you need a quick fix.
<br><br>Well, Nick Coghlan pointed out in private email:<br><br>>> According to PEP 352 it should have at most been deprecated along with the<br>>> rest of Exception.__getitem__:<br>>><br>>> "This also means providing a __getitem__ method is unneeded for exceptions and
<br>>> thus will be deprecated as well."</blockquote><div><br>Right, the deprecation is not scheduled until Python 2.9 for __getitem__ so it was a regression problem (was never a test for it before PEP 352 was written). The fix is now in so your code should work again from a trunk checkout. I will backport when the freeze is raised.
<br></div><br>-Brett</div>