[Patches] [ python-Patches-639307 ] new string method -- format

noreply@sourceforge.net noreply@sourceforge.net
Sat, 16 Nov 2002 04:20:47 -0800


Patches item #639307, was opened at 2002-11-16 07:20
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=639307&group_id=5470

Category: Core (C code)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Jp Calderone (kuran)
Assigned to: Nobody/Anonymous (nobody)
Summary: new string method -- format

Initial Comment:
Attached patch adds a method, 'format', to str and
unicode types.  The method performs the same operation
as the string interpolation operator.

The patch also includes modifications to test_format.py
as well as libstdtypes.tex (tex code untested - I can't
figure out latex; hopefully it is correct though, much
is copy/pasted from elsewhere).

Aside from having wanted this method forever, one of my
use cases is building a list of objects to be displayed
in a somewhat generic fashion.  Currently an explicit
function is required for the simple operation of string
interpolation, either by def'ing one or using a lambda,
while other, more complex operations.  Example attached.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=639307&group_id=5470