[Python-Dev] string.Template format enhancements (Re: Replacement for print in Python 3.0) (original) (raw)
tanzer@swing.co.at tanzer at swing.co.at
Tue Sep 6 16🔞42 CEST 2005
- Previous message: [Python-Dev] string.Template format enhancements (Re: Replacement for print in Python 3.0)
- Next message: [Python-Dev] Replacement for print in Python 3.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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/
- Previous message: [Python-Dev] string.Template format enhancements (Re: Replacement for print in Python 3.0)
- Next message: [Python-Dev] Replacement for print in Python 3.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]