[issue18642] enhancement for operator 'assert'

Mark Dickinson report at bugs.python.org
Sat Aug 3 15:40:07 CEST 2013


Mark Dickinson added the comment:

Ah, so I think I don't understand the proposal.  In your original message,  is it your intention that the assert raises TypeError, or that it raises AssertionError?

Again:  what's the benefit over existing solutions?  Either:

    if not isinstance(data, basestring):
        raise TypeError("Bad user!  You gave me the wrong type")

or

    assert isinstance(data, basestring), "data should be a string at this point"

?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18642>
_______________________________________


More information about the Python-bugs-list mailing list