A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-September/056233.html below:

Replacement for print in Python 3.0)

[Python-Dev] string.Template format enhancements (Re: Replacement for print in Python 3.0) [Python-Dev] string.Template format enhancements (Re: Replacement for print in Python 3.0)tanzer@swing.co.at tanzer at swing.co.at
Tue Sep 6 16:18:42 CEST 2005
Nick Coghlan <ncoghlan at gmail.com> wrote:

> With the above changes, the following would work:
>    "$1: $2".format("Number of bees", "0.5")
> And produce:
>    "Number of bees: 0.5"
> 
> When pre-compiling string.Templates, the keyword method is
> significantly clearer, but if the syntax was accessible through a
> string method, then being able to use positional arguments would
> be very handy.

As long as named arguments don't get lost, that's fine. I
often use templates stored in variables/passed around as
arguments, where the positional form is not clear at all:

    template.format("Number of bees", "0.5")

-- 
Christian Tanzer                                    http://www.c-tanzer.at/

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4