<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>Wiadomość napisana przez Nick Coghlan w dniu 2010-08-04, o godz. 23:57:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>2010/8/5 Fred Drake <<a href="mailto:fdrake@acm.org">fdrake@acm.org</a>>:<br><blockquote type="cite">2010/8/4 Łukasz Langa <<a href="mailto:lukasz@langa.pl">lukasz@langa.pl</a>>:<br></blockquote><blockquote type="cite"><blockquote type="cite">1. The patch makes KeyError behave analogically to IOError so that the first<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">arg is now a message and the second is the actual key.<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I agree with Antoine; there's no point to this.<br></blockquote></div></blockquote><div><br></div><div>So I'm proposing to close the original issue #2651 and not include what's there.</div><div>(see below though)</div><br><blockquote type="cite"><div><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">2. Some people suggest adding e.key to KeyError. I like the idea but in my<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">opinion currently it is not implementable in a reliable way.<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">This is interesting and useful.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I'd be really happy to see e.key be present if the key is known<br></blockquote><blockquote type="cite">(because it was specifically provided to the constructor:<br></blockquote><blockquote type="cite">KeyError(key=...)), or not present if the key isn't known. (The idea<br></blockquote><blockquote type="cite">is much less interesting if code can't distinguish between the<br></blockquote><blockquote type="cite">key-is-known and the key-not-known cases.)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">The runtime and standard library should be adjusted to provide the key<br></blockquote><blockquote type="cite">whenever possible, of course.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Though I doubt this would break anything, we've lived without this<br></blockquote><blockquote type="cite">long enough that the it doesn't represent a sufficient failing that<br></blockquote><blockquote type="cite">the moratorium should be broken. It can wait.<br></blockquote><br>+1 on what Fred said (i.e. post-moratorium, add a keyword-only "key"<br>argument to KeyError, set "e.key" only if that argument is supplied,<br>update the standard library to supply it and use a default message of<br>"'Key not found: %r' % key" if the key argument is supplied without an<br>explicit message). Also +1 for doing the equivalent with<br>AttributeError and an "attr" keyword only argument.<br></div></blockquote><div><br></div><div>Good stuff guys. Shall we do an e.index for IndexErrors as well?</div><br><blockquote type="cite"><div>Since a keyword-only approach doesn't actually *break* any current<br>code, I'm only -0 on doing that for 3.2 rather than -1.<br></div></blockquote><div><br></div><div>I'm -1 because we would alter the standard library to use this functionality</div><div>which would make it incompatible with other implementations. That is of</div><div>course unless Guido says we should add it anyway ;)</div><div><br></div><div>We might create a separate issue superseding #2651 which will be all about</div><div>presenting sensible named arguments for built-in exceptions. Does this sound</div><div>like a good plan?</div><div><br></div></div><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Verdana; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Verdana; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Verdana; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Verdana; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Verdana; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Verdana; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px; ">-- </span></font></div><div><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px; ">Best regards,</span></font></div><div><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px; ">Łukasz Langa</span></font></div><div><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px; ">tel. +48 791 080 144</span></font></div><div><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 12px; ">WWW <a href="http://lukasz.langa.pl/">http://lukasz.langa.pl/</a></span></font></div></div></span></div></span></div></span></div></span></div></span></span>
</div>
<br></body></html>