[Python-ideas] Making assert raise a different exception type
cool-rr at cool-rr.com
Fri Oct 16 19:08:55 CEST 2009
Right. The reason I want it in an `assert` is to make use of the `-o` tag.
And I would prefer to raise a more informative exception than
On Fri, Oct 16, 2009 at 6:52 PM, Guido van Rossum <guido at python.org> wrote:
> I don't think so. You can already write
> if not some_false_condition:
> raise ValueError("Message")
> On Fri, Oct 16, 2009 at 9:16 AM, cool-RR <cool-rr at cool-rr.com> wrote:
> > Hello!
> > I would have liked to do something like this:
> > assert some_false_condition, ValueError("Message")
> > Meaning that if the assertion fails, the ValueError is raised instead of
> > AssertionError. Do you think it's something that has a chance of being
> > implemented? If so, I will write a PEP.
> > Ram.
> > _______________________________________________
> > Python-ideas mailing list
> > Python-ideas at python.org
> > http://mail.python.org/mailman/listinfo/python-ideas
> --Guido van Rossum (home page: http://www.python.org/~guido/)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas