On 3/27/06, Brett Cannon <[EMAIL PROTECTED]> wrote: > Requiring code that can identify things in 2.x that will change in 3.0 > that are coded externally from the interpreter is going to be *really* > difficult in some situations, if not impossible to get right. Just > look at dict.items(); how do you do that?
You issue a warning for every .items() call. If you want to be a little more intelligent about it, you issue a warning to every .items() call that isn't used directly in a for-loop. Sure, it's going to generate false-positives[1], but the PEP says that's okay. At least in my own code, it wouldn't generate that many false positives either -- most of my calls to items are on builtin dicts. Others who use a lot of custom dict-like objects would get more, but the custom dict-like objects likely need upgraded to the Python 3000 interface as well. Maybe each PEP should have it's own flag to enable/disable the warnings issued by python3warn.py? Then after you'd checked all your .items() calls (and presumably corrected them or determined they were false-positives), you could ask python3warn.py to stop warning you. Steve [1] It's going to generate some false-negatives too, when someone's done something like ``func = mydict.items``. But we're never going to get perfect warnings (unless people are crazy enough to want to maintain the branch), so I'm willing to accept that. -- 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