On 28.11.2017 6:34, Ned Batchelder wrote:


You are proposing:

    assert condition, type, value
Not specifically this, that's just an example.

Actually, the way I'm using them,

    assert condition, "error message", type

would probably be the most expressive way.

Why not just use Python as it is now, with this:?
It's the most expressive way the language provides to write that logic.
With Python's design focus on promoting expressive, readable and intuitive syntax, that's enough of a reason.

    if not condition: raise type(value)

I don't see a reason to change the assert statement. You can do what you need without the change.
I can do anything in any Turing-complete language without any changes to the language. That's no reason to never change anything, is it.

The rationale basically is:
* As it was intended, the statement has no practical use -- basically a rudiment, due to disappear eventually
* It can instead be reused as syntax sugar to cover a very common use case

--
Regards,
Ivan

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to