proto-PEP: interpolated strings using ""if

Anthony Baxter anthony at interlink.com.au
Sat Feb 8 01:10:06 EST 2003


PEP: XXX
Title: Interpolated strings using a postfix "if"
Version: 1.1
Author: Anthony Baxter

Introduction

    There have been many requests for interpolated strings over
    the years - see, e.g. PEP 215. Since "if" is apparently 
    the dumping ground token to get all sorts of functionality
    bolted on to it, this PEP proposes the format "somestring"if
    postfix for a string to mark that the string requires 
    interpolation. 

Discussion

    This will save a couple of keystrokes here and there, and
    avoids using a magic punctuation character. See PEP 215
    for the mechanics of string interpolation.

Examples

    >>> a, b = 5, 6
    >>> print "a = $a, b = $b"if
    a = 5, b = 6










More information about the Python-list mailing list