[issue46291] [doc] First argument to raise can also be BaseException

2022-03-15 Thread Irit Katriel
Change by Irit Katriel : -- keywords: +patch pull_requests: +29995 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31899 ___ Python tracker ___ ___

[issue46291] [doc] First argument to raise can also be BaseException

2022-03-08 Thread Irit Katriel
Irit Katriel added the comment: @gtitze - are you still planning to work on this? -- ___ Python tracker ___ ___ Python-bugs-list ma

[issue46291] [doc] First argument to raise can also be BaseException

2022-01-08 Thread Vedran Čačić
Vedran Čačić added the comment: Let me just say that I use `raise SystemExit` all the time. Beats `from sys import exit`, weird error messages about having to type parentheses, and surely beats "oh, am I on Windows so Ctrl+Z, or on Linux so Ctrl+D". :-] I also use `raise KeyboardInterrupt` so

[issue46291] [doc] First argument to raise can also be BaseException

2022-01-07 Thread Irit Katriel
Irit Katriel added the comment: Make a PR and we can then tweak it via code reviews, it will be easier. -- ___ Python tracker ___ _

[issue46291] [doc] First argument to raise can also be BaseException

2022-01-07 Thread Gregor Titze
Gregor Titze added the comment: Irit: I would move the paragraph starting with "The except clause may specify a variable after the exception name ..." and the following example before the paragraph starting with "All exceptions inherit from BaseException, and so it can be used to serve as a

[issue46291] [doc] First argument to raise can also be BaseException

2022-01-07 Thread Gregor Titze
Gregor Titze added the comment: Andre: You mention that user-defined exceptions should inherit from Exception. This is totally right and explicitly stated just a bit later in 8.6 on the same page of the tutorial. I think this perfectly covers this concern . However, the paragraph I refer to

[issue46291] [doc] First argument to raise can also be BaseException

2022-01-07 Thread Andre Roberge
Andre Roberge added the comment: >> For this advice (catching Exception and not BaseException) to be correct, >> users should be advised (as they are in the tutorial) to raise exceptions >> derived from Exception (and not BaseException). > I disagree with that. You are a core developer and

[issue46291] [doc] First argument to raise can also be BaseException

2022-01-07 Thread Irit Katriel
Irit Katriel added the comment: > For this advice (catching Exception and not BaseException) to be correct, > users should be advised (as they are in the tutorial) to raise exceptions > derived from Exception (and not BaseException). I disagree with that. -- ___

[issue46291] [doc] First argument to raise can also be BaseException

2022-01-07 Thread Andre Roberge
Andre Roberge added the comment: Irit: In all the books and tutorials I have seen, the advice is to try to catch specific exceptions whenever possible or, *at most*, to catch Exception (and not BaseException). This is to allow, for example, a program to be interrupted by a KeyboardInterru

[issue46291] [doc] First argument to raise can also be BaseException

2022-01-07 Thread Irit Katriel
Irit Katriel added the comment: Andre, are you saying that we should only RAISE Exception subclasses? -- ___ Python tracker ___ ___

[issue46291] [doc] First argument to raise can also be BaseException

2022-01-07 Thread Andre Roberge
Andre Roberge added the comment: Irit: Gregor indicates that, while the tutorial refers to "a class that derives from Exception", the Python Reference Language states exceptions should be subclasses of BaseException (which Exception *is*). You then invited Gregor to submit a patch to chang

[issue46291] [doc] First argument to raise can also be BaseException

2022-01-07 Thread Irit Katriel
Change by Irit Katriel : -- keywords: +easy ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue46291] [doc] First argument to raise can also be BaseException

2022-01-07 Thread Irit Katriel
Change by Irit Katriel : -- versions: -Python 3.6, Python 3.7, Python 3.8 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue46291] [doc] First argument to raise can also be BaseException

2022-01-07 Thread Irit Katriel
Irit Katriel added the comment: There are other issues in this doc: 1. The paragraph starting with "The except clause may specify a variable after the exception name.." appears after this face was used in an example. It should move up. 2. In the User-defined Exceptions Section, there is a l

[issue46291] [doc] First argument to raise can also be BaseException

2022-01-07 Thread Irit Katriel
Irit Katriel added the comment: Andre, I don't follow. The OP is reporting an issue with a line about raising exceptions. Why is it correct to advise us to raise only Exception subclasses? -- ___ Python tracker

[issue46291] [doc] First argument to raise can also be BaseException

2022-01-07 Thread Andre Roberge
Andre Roberge added the comment: In https://docs.python.org/3/library/exceptions.html#Exception, it is written: "All built-in, non-system-exiting exceptions are derived from this class. All user-defined exceptions should also be derived from this class." Yes, technically, the root of all exc

[issue46291] [doc] First argument to raise can also be BaseException

2022-01-07 Thread Irit Katriel
Irit Katriel added the comment: If you scroll up, you can see that BaseException was mentioned above: "All exceptions inherit from BaseException, and so it can be used to serve as a wildcard" so I don't think it will add confusion to fix this. And it will be more accurate. Gregor, would yo

[issue46291] [doc] First argument to raise can also be BaseException

2022-01-07 Thread Nikita Sobolev
Nikita Sobolev added the comment: I think that this is intentional: tutorial gives some very basic ideas about what can be raised. Giving the whole context (you can `raise` two kinds of errors: `Exception` and `BaseException`, but they are different, should be used in different cases, and th

[issue46291] [doc] First argument to raise can also be BaseException

2022-01-07 Thread Gregor Titze
New submission from Gregor Titze : The Python Tutorial describes the first argument to the raise statement as follows: """ This must be either an exception instance or an exception class (a class that derives from Exception). """ https://docs.python.org/3/tutorial/errors.html#raising-exceptio