On 4/13/06, Jack Diederich <[EMAIL PROTECTED]> wrote: > 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?
Yeah, that sounds like a good idea. I'll update the PEP to require that. Steve -- Grammar am for people who can't think for myself. --- Bucky Katt, Get Fuzzy _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com