[EMAIL PROTECTED] wrote: > >> Is there a 2-to-3 fixer for % format? I scanned the fixes directly > >> quickly but didn't see anything obvious. > > Benjamin> I believe the only reason that % is even in 3.0 is that a 2to3 > Benjamin> fixer couldn't be easily written for it. > > I find that kind of hard to believe (that it should be terribly difficult to > write a fixer, at least given a % operator with a string literal LHS and > either a tuple or dict RHS or a call to locals() or globals()).
That's exactly the problem though - while a 2to3 fixer can be written for a tiny subset of formatting calls (those that meet the constraints you gave), the vast majority are out of luck without some major type inferencing additions to 2to3. Given the expression "x % y", 2to3 hasn't got a clue whether it needs to do anything unless it somehow knows the types of x and y. So my understanding matches Benjamin's: while string %-formatting is definitely a 'second way' to do something for which str.format will be the preferred approach, getting rid of it for Py3k just isn't worth the staggering amount of breakage that would result. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org _______________________________________________ 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