[Python-ideas] String formatting and namedtuple

Steven D'Aprano steve at pearwood.info
Wed Feb 11 23:49:05 CET 2009


Guido van Rossum wrote:
> On Wed, Feb 11, 2009 at 1:18 PM, Adam Olsen <rhamph at gmail.com> wrote:
>> On Wed, Feb 11, 2009 at 5:09 AM, Lie Ryan <lie.1296 at gmail.com> wrote:
>>> Is % interpolation deprecated? I've never heard of that...
>> There's no plans to remove it in the near future, so it's not
>> deprecated, and there's no problem using it when it's convenient.
>>
>> However, .format() obsoletes it.  .format() is significantly more
>> powerful for reasons just like this.  There's no reason to add new
>> features to % interpolation with .format() around.
> 
> I thought the plan was to start deprecating % in 3.1 and remove it at
> some later release (maybe 3.3). Or did I miss a reversal on this?

Judging by responses on comp.lang.python deprecating % will make a lot 
of people deeply unhappy. Personally, my own feeling is that they're 
(mostly) just objecting to change, but they do make some good points.

In a later post, Guido wrote:

"Without deprecation as the stick I doubt that they will bother to even 
try [format]."

I think you under-estimate just how much many programmers like to play 
with shiny new tools. I installed Python 2.6 specifically so I could try 
format. My conclusion is that it is a nice, powerful *heavyweight* 
solution for text formatting. It's great for complex tasks, but it's 
hard to beat % for simple ones.



-- 
Steven




More information about the Python-ideas mailing list