Al Korgun added the comment:
Mark Dickinson, sorry, didn't answer the first questiuon.
>> In your original message, is it your intention that the assert raises
>> TypeError, or that it raises AssertionError?
I suggest to add the ability to raise relevant (for specific part of
Al Korgun added the comment:
Mark Dickinson, #1 if dedug (and type check, respectively, as in this example,
and 'raise') isn't needed we just need pyo
>> Python won't execute those asserts at all
that is convenient.
if not isinstance(data, basestring):
raise Type
Al Korgun added the comment:
Mark Dickinson, and I just think it might be useful in debug. PYO is another
story.
--
___
Python tracker
<http://bugs.python.org/issue18
New submission from Al Korgun:
It would be pretty good, if 'assert' could raise specified exception, like that:
>>> data = None
>>> assert isinstance(data, basestring), TypeError("'data' must be a string")
AssertionErrorTypeError: 'data&
Changes by Al Korgun :
--
versions: +Python 2.6
___
Python tracker
<http://bugs.python.org/issue16766>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Al Korgun:
>>> import htmlentitydefs
>>> htmlentitydefs.name2codepoint.get("quot") # ok
34
>>> htmlentitydefs.name2codepoint.get("apos", "null") # ' -> chr(39)
'null'
--
components: L