[Python-Dev] Re: [Python-checkins] python/dist/src/Lib warnings.py,1.19,1.20 (original) (raw)

Guido van Rossum guido@python.org
Thu, 15 May 2003 10:27:58 -0400


Fred> Guido van Rossum writes: >> Agreed, but you're still using two levels of quoting, and with >> anything less, "foo.bar" will also match a module named "foolbar".

Fred> Agreed. "foo.bar" will match "foolbar" as well, but 'foo.bar' Fred> only matches "foo.bar". Coming back to my original question, does it make sense to allow regular expressions in the message and module fields in a -W command line arg? The complexity of all the shell/re quoting suggests not, but having -W args treated differently than the args to filterwarnings() doesn't seem right. Perhaps this is something that never happens in practice. I've never used -W. Are there people out there who have used it and wished the message and module fields could be regular expressions? Conversely, does anyone make use of the fact that the message and module args to filterwarnings() can be regular expressions? Looking through the Python source I see several examples of filterwarning() where one or the other of the message and module args are regular expressions, so that answers the second question. The first remains open.

I'll call YAGNI on regexps for -W.

--Guido van Rossum (home page: http://www.python.org/~guido/)