Message116843
(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. |
|
Date |
User |
Action |
Args |
2010-09-19 00:13:03 | tlynn | set | recipients:
+ tlynn, loewis, georg.brandl, rhettinger, niemeyer, timehorse, mrabarnett, r.david.murray |
2010-09-19 00:13:02 | tlynn | set | messageid: <1284855182.02.0.86487141542.issue1708652@psf.upfronthosting.co.za> |
2010-09-19 00:13:00 | tlynn | link | issue1708652 messages |
2010-09-19 00:12:57 | tlynn | create | |
|