Terry J. Reedy added the comment:
Steven and Mark are correct that a tracker patch cannot change a 3rd party
module. On the other hand, we are free to improve error messages in new
versions. And we are free to borrow ideas from 3rd part modules. I changed the
title accordingly.
(Back compatibility comes into play in not making message enhancements in
bugfix releases even though message details are not part of the documented API.
People who write code that depends on those details, and doctexts need not so
depend, should expect to revise for new versions. I expect that some of our re
tests would need to be changed.)
Re and regex are a bit special in that regex is the only re replacement (that I
know of) and is (almost) a drop-in replacement. So some people *are*, on
their own, replacing re with regex by installing regex (easy with pip) and
adding 'import regex as re' at the top of their code.
Serhiy suggested either picking the best or writing a new one, I think a new
one combining both would be best in many of the cases. As a user, I like "name
missing terminal '>'" for #2 (is there an adjective for a name in this
context?) and for #4, "group name missing terminal '>'". (Note that we usually
quote literals, as in #8.) For #12, I would like a parallel construction "set
expression missing terminal ']'" if that is possible. But the currently vague
re message "unexpected end of regular expression" might be raised as a point
where the specific information is lost and only the general version is correct.
As for #14, either UNICODE and LOCALE *are* compatible (for re) or this is
buggy.
>>> import re
>>> re.compile(r'\w', re.UNICODE | re.LOCALE)
re.compile('\\w', re.LOCALE|re.UNICODE)
----------
title: Unify error messages of re and regex -> Improve some re error messages
using regex for hints
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue22364>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com