Talin wrote:
> s = str.convert( f, "2.2g" )
If format is a string method, then you will already be
able to do
s = str.format("2.2g", f)
if you want.
--
Greg
___
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/lis
Greg Ewing wrote:
> Talin wrote:
>
>> s = str.convert( f, "2.2g" )
>
> If format is a string method, then you will already be
> able to do
>
>s = str.format("2.2g", f)
>
> if you want.
Nope. Given the current PEP, it'd have to be one of the following:
s = "{0:2.2g}".format(f)
s
On 6/22/06, Nick Coghlan <[EMAIL PROTECTED]> wrote:
> However, I realised that there's an approach that is aesthetically pleasing
> and doesn't require using str() for this - simply consider the leading '{0:'
> and trailing '}' to be implicit if there are no braces at all in the supplied
> format s
On 6/22/06, Nick Coghlan <[EMAIL PROTECTED]> wrote:
> However, I realised that there's an approach that is aesthetically pleasing
> and doesn't require using str() for this - simply consider the leading '{0:'
> and trailing '}' to be implicit if there are no braces at all in the supplied
> format s
Guido van Rossum wrote:
> To Talin: I'm all for a way to say blah(x, "2.2g") instead of the more
> verbose "{2.2g}".format(x). In fact it would probably be great if the
> latter was officially defined as a way to spell the former combined
> with literal text:
>
> "foo{2.2g}bar{3.3f}spam".format(