Tom Lynn <tl...@users.sourceforge.net> added the comment:

(Sorry to comment on a closed issue, it was closed as I was writing this.)  
It's not that I'm not convinced of the need, just not of the solution.  I still 
think that there are problems here:

a) forgetting any \Z or $ terminator to .match() is easy,
b) $ is easily misunderstood (and not just by me) and I suspect commonly 
dangerously misused in validation routines as a result,
c) '(?:%s)\Z' % regexp is noisy, combines two less-understood features, and 
makes simple regexps hard to read,
d) '(?:%s)\Z' % regexp.pattern requires recompilation of the regexp.

I think another method is probably the best solution to these, but it may have 
too much cost (though I'm not sure what that cost would be).

Largely orthogonally, I'd like to see \Z encouraged over $ in the docs, and 
preferably a version of this table (probably under Matching vs Searching), 
corrected if I'm wrong of course:

NON-MULTILINE:
    '^' is equivalent to '\A'
    '$' is equivalent to '(?:\Z|(?=\n\Z))'

MULTILINE:
    '^' is equivalent to '(?:\A|(?<=\n))'
    '$' is equivalent to '(?:\Z|(?=\n))'

But the docs already try to express the above table (or its correction) in 
English, so you may feel it wouldn't add anything, in which case I'd still like 
to see any corrections for my own edification if possible.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue1708652>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to