[issue18162] Add index attribute to IndexError

2015-12-31 Thread Ezio Melotti
Ezio Melotti added the comment: And PEP 473. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.py

[issue18162] Add index attribute to IndexError

2015-12-31 Thread Ezio Melotti
Ezio Melotti added the comment: See also #1182143. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue18162] Add index attribute to IndexError

2015-04-15 Thread Ofer Schwarz
Changes by Ofer Schwarz : Added file: http://bugs.python.org/file39060/indexerror_all.patch ___ Python tracker ___ ___ Python-bugs-list mailin

[issue18162] Add index attribute to IndexError

2015-04-15 Thread Ofer Schwarz
Changes by Ofer Schwarz : -- keywords: +patch Added file: http://bugs.python.org/file39055/indexerror.patch ___ Python tracker ___ ___

[issue18162] Add index attribute to IndexError

2015-04-15 Thread Ofer Schwarz
Changes by Ofer Schwarz : Added file: http://bugs.python.org/file39056/indexerror.tests ___ Python tracker ___ ___ Python-bugs-list mailing li

[issue18162] Add index attribute to IndexError

2015-04-15 Thread Ram Rachum
Ram Rachum added the comment: Looking forward to your patch Ofer! Thanks for working on this! -- ___ Python tracker ___ ___ Python-bug

[issue18162] Add index attribute to IndexError

2015-04-15 Thread Ofer Schwarz
Ofer Schwarz added the comment: I'm working on this now (patch hopefully coming soon), and I've hit an interesting issue: PySequence methods take care of negative indexes by adding +len before calling the subclass method (s.t. -1 becomes len-1 etc.). This means that if the subclass raises an e

[issue18162] Add index attribute to IndexError

2014-07-05 Thread Brett Cannon
Brett Cannon added the comment: Part of the point of these various attributes I proposed was so that a good default message could be provided when only the new attributes are given. So I'm fine with that being part of this issue. -- ___ Python track

[issue18162] Add index attribute to IndexError

2014-07-05 Thread Ezio Melotti
Ezio Melotti added the comment: Knowing the len of the sequence would also be useful. Brett, were you also planning to use these attributes in the error message (when they are available), or do you prefer to keep the two issues separate and reopen #21911? > Is there a meta-issue for these chan

[issue18162] Add index attribute to IndexError

2014-07-05 Thread Ram Rachum
Ram Rachum added the comment: Since #21911 has been merged into this issue, I'd like to add: Please also include the length of the sequence in the exception message. It can help with debugging. -- nosy: +cool-RR ___ Python tracker

[issue18162] Add index attribute to IndexError

2014-01-31 Thread Yury Selivanov
Changes by Yury Selivanov : -- versions: +Python 3.5 -Python 3.4 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue18162] Add index attribute to IndexError

2013-11-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also issue1534607. -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mail

[issue18162] Add index attribute to IndexError

2013-06-18 Thread R. David Murray
R. David Murray added the comment: I am in favor of adding meaningful attributes to stdlib exceptions. I've always considered the lack of such an API a wart in Python, though an understandable one (since exceptions started out as simple strings). But yeah, while I hate to say it, this is pro

[issue18162] Add index attribute to IndexError

2013-06-18 Thread Brett Cannon
Brett Cannon added the comment: Do you mean "sometimes there sometimes not" because old code won't set it (yet) or because you don't think it will always be appropriate to set the attribute and thus people won't set it when available? -- ___ Python

[issue18162] Add index attribute to IndexError

2013-06-17 Thread Raymond Hettinger
Raymond Hettinger added the comment: -1 on expanding the API for an attribute that is sometimes there and sometimes not. This doesn't add any value, but it does add complication. -- ___ Python tracker ___

[issue18162] Add index attribute to IndexError

2013-06-15 Thread Brett Cannon
Brett Cannon added the comment: Obviously it can't be required that the index be provided as that would break way too much code. There are already exceptions in the stdlib that have optional attributes you can choose to (not) set. As for relying upon it, it would be just like any other object

[issue18162] Add index attribute to IndexError

2013-06-15 Thread Raymond Hettinger
Raymond Hettinger added the comment: I would also like to see a PEP or good python-dev discussion before embarking on all these API expansions. There should be an evaluation of whether any existing code would benefit from it, whether the current "args" attribute is sufficient, whether the cod

[issue18162] Add index attribute to IndexError

2013-06-15 Thread Brett Cannon
Brett Cannon added the comment: Nope, no meta-issue. I literally just realized one evening that the handful of exceptions that I filed bugs for could use an attribute for why the exception was raised. -- ___ Python tracker

[issue18162] Add index attribute to IndexError

2013-06-15 Thread Ezio Melotti
Ezio Melotti added the comment: Is there a meta-issue for these changes? I remember a similar discussion a couple of years ago, but I don't remember if it was on python-dev/ideas or on the bug tracker. I agree that exceptions could be improved, but I would like to get the big picture of the cha

[issue18162] Add index attribute to IndexError

2013-06-14 Thread Chris Rebert
Changes by Chris Rebert : -- nosy: +cvrebert ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python

[issue18162] Add index attribute to IndexError

2013-06-09 Thread Brett Cannon
Brett Cannon added the comment: Yes, I mean weakref. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://

[issue18162] Add index attribute to IndexError

2013-06-08 Thread Éric Araujo
Éric Araujo added the comment: regex? do you mean weakref? -- nosy: +eric.araujo ___ Python tracker ___ ___ Python-bugs-list mailing

[issue18162] Add index attribute to IndexError

2013-06-07 Thread Barry A. Warsaw
Changes by Barry A. Warsaw : -- nosy: +barry ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python

[issue18162] Add index attribute to IndexError

2013-06-07 Thread Brett Cannon
New submission from Brett Cannon: Give IndexError an index attribute to store the index it was raised for. Since it is typically an integer there is no reason to worry about GC and thus using a regex. -- components: Interpreter Core messages: 190777 nosy: brett.cannon priority: normal