On Thu, Apr 13, 2006 at 10:07:27AM -0600, Steven Bethard wrote: > This should be pretty similar to the last time I posted it, but now > it's got an official PEP number. Let me know what you think! > > Identifying Problematic Code > ============================ > > This PEP proposes to house this code in tools/scripts/python3warn.py. > Thus PEPs for backwards incompatible changes should include a patch to > this file that produces the appropriate warnings. Code in > python3warn.py should be written to the latest version of Python 2.X > (not Python 3000) so that Python 2.X users will be able to run the > program without having Python 3000 installed. > > So for example, a PEP proposing that ``dict.items()`` be modified to > return an iterator instead of a list might add code like the following > to python3warn.py:: > > items_in_for = re.compile(r'for\s+\w+\s+in\s+\w+\.items\(\):') > ... > for i, line in enumerate(file_lines): > ... > if '.items()' in line and not items_in_for.search(line): > message = 'dict.items() call may expect list at line %i' > warnings.warn(message % i)
Could we mandate that all warnings use warnings.showwarning() and provide the right filename and line number? That would make it very easy to run the script in an editor and step through all the lines that might need changes. Any editor with a unix tradition should be able to handle the format 'filename:line number:message' - I don't know if windows has any tradition here. -Jack _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
