Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #22412

Re: string interpolation for python

References <CABgq=FyhR+Ldujj3YKRBpVXRVoeoayuXZviUUcNx-gXnFiHLSw@mail.gmail.com> <CACoeR0xV=28j6rFHm1ep3gzH9C0sbDqyxRRwX-JrVm3G+rrXww@mail.gmail.com> <1333174946.18436.YahooMailNeo@web121506.mail.ne1.yahoo.com>
Date 2012-03-31 00:51 -0700
Subject Re: string interpolation for python
From Chris Rebert <clp2@rebertia.com>
Newsgroups comp.lang.python
Message-ID <mailman.1173.1333180312.3037.python-list@python.org> (permalink)

Show all headers | View raw


On Fri, Mar 30, 2012 at 11:22 PM, Yingjie Lan <lanyjie@yahoo.com> wrote:
> Hi all,
>
> I'd really like to share this idea of string interpolation for formatting.
> Let's start with some code:
>
>>>> name = "Shrek"
>>>> print( "Hi, $name$!")
> Hi, Shrek!

Python already has *3* different built-in string
formatting/interpolation systems:
http://docs.python.org/library/string.html#template-strings
http://docs.python.org/library/string.html#format-string-syntax
http://docs.python.org/library/stdtypes.html#string-formatting-operations
Do we really want to add yet another to this pile?

I would surmise that your key "implicitly grab variable values from
the enclosing scope" feature has previously been rejected for being
too magical.

Cheers,
Chris
--
http://rebertia.com

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: string interpolation for python Chris Rebert <clp2@rebertia.com> - 2012-03-31 00:51 -0700

csiph-web