Dec-13-2019, 05:24 AM
(This post was last modified: Dec-13-2019, 05:24 AM by Clunk_Head.)
Quote:can i raise an exception in a try clause?Yes, this is often the reason for using a try / except block. Simply raise the exception, but be sure to use the correct exception type. In you case a datum that is too old would be a ValueError as you suggested.
I use a try with a half-dozen except blocks to help the user under their mistakes in my calculator application.
Now here's the important question. Have you tried it?
Try it and post your results here if you have errors.