Re: [Python-3000] Implementing % formatting in terms of str.format() Steven Bethard schrieb:
> On Sat, Apr 12, 2008 at 8:26 AM,   wrote:
>>
>>     Nick> That's exactly the problem though - while a 2to3 fixer can be
>>     Nick> written for a tiny subset of formatting calls (those that meet the
>>     Nick> constraints you gave)...
>>
>>  In my personal experience, either the LHS will be a string literal or the
>>  RHS will be locals(), globals() or a tuple.  Yes, you will have a hard, if
>>  not impossible, time with the general x % y.  Still, I think a fixer that
>>  only addresses the "tiny subset" would go a long ways to converting existing
>>  code.  For the rest it could insert special comments so the programmer can
>>  grep for the problematic cases.
> 
> Rather than inserting special comments, why don't we just introduce a
> -3 warning for using % string formatting? Then, you can use 2to3 to
> convert as much as it can, and you can use the -3 warning to identify
> any other places you're using % string formatting and fix them by
> hand. Adding such a -3 warning shouldn't be much more than a couple of
> lines at the beginning of stringobject.c:PyString_Format.

Please don't -- a Py3k warning makes no sense if the feature isn't really
going away in Py3k. Py3k warnings really should only warn about things
that are going to break in 3.0.

If the decision is reached that such a warning makes sense, I'd propose
to only warn in an "extended Py3k warning mode" activated with -33.

Georg


-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.

_______________________________________________
Python-3000 mailing list
smsbmo-9552@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: http://mail.python.org/mailman/options/python-3000/python-3000%40tangomu.com


