Mark Dickinson wrote: > On Mon, Feb 2, 2009 at 10:36 AM, Nick Coghlan <ncogh...@gmail.com> wrote: >> Such a warning should also be present when >> running with -3 in 2.7 (assuming it isn't already there). > > I'm not sure how/whether that would work, given that there are > probably still plenty of 2.7 modules in the distribution that > (quite legitimately) define tp_compare but not tp_richcompare.
That's what the -3 command line switch is for - it sets a boolean flag that C code can check to see if it should emit warnings for things that are going to break in Python 3.x. There's already at least one example of its use in typeobject.c (relating to inheritance of the tp_hash slot). There are a few other examples about the place (e.g. I believe that when -3 is defined the return value of dict.keys and friends is changed to a list subclass that warns on certain operations that have different semantics in 3.x). Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia --------------------------------------------------------------- _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com