[issue18642] enhancement for operator 'assert'

2013-08-03 Thread Al Korgun

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' must be a string

--
components: Interpreter Core
messages: 194250
nosy: WitcherGeralt
priority: normal
severity: normal
status: open
title: enhancement for operator 'assert'
type: enhancement
versions: Python 2.7

___
Python tracker 
<http://bugs.python.org/issue18642>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18642] enhancement for operator 'assert'

2013-08-03 Thread Al Korgun

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/issue18642>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18642] enhancement for operator 'assert'

2013-08-03 Thread Al Korgun

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 TypeError(...)

- here we need additionally check debug variable, use wrapper or something.
#2 'assert' is a good breakpoint (sorry, bad english. not sure if this is what 
I wanted to say) on its own. And to orientate on check & 'raise' we have to 
mark it somehow.
#3 Well, the code is shorter, obviously.

R. David Murray, yes, maybe confusing, but I can imagine many ways when it is 
very convenient.

--

___
Python tracker 
<http://bugs.python.org/issue18642>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18642] enhancement for operator 'assert'

2013-08-03 Thread Al Korgun

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 code) 
exception on checking assertion.

--

___
Python tracker 
<http://bugs.python.org/issue18642>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16766] small disadvantage of htmlentitydefs

2012-12-24 Thread Al Korgun

New submission from Al Korgun:

>>> import htmlentitydefs
>>> htmlentitydefs.name2codepoint.get("quot")  # ok
34
>>> htmlentitydefs.name2codepoint.get("apos", "null")  # ' -> chr(39)
'null'

--
components: Library (Lib)
messages: 178060
nosy: WitcherGeralt
priority: normal
severity: normal
status: open
title: small disadvantage of htmlentitydefs
versions: Python 2.7

___
Python tracker 
<http://bugs.python.org/issue16766>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16766] small disadvantage of htmlentitydefs

2012-12-24 Thread Al Korgun

Changes by Al Korgun :


--
versions: +Python 2.6

___
Python tracker 
<http://bugs.python.org/issue16766>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com