%a format

John Lenton john at grulic.org.ar
Wed Sep 8 02:21:08 CEST 2004


On Tue, Sep 07, 2004 at 04:48:25PM -0700, Dan Bishop wrote:
> Tor Iver Wilhelmsen <tor.iver.wilhelmsen at broadpark.no> wrote in message news:<usm9tx5n3.fsf at broadpark.no>...
> > John Lenton <john at grulic.org.ar> writes:
> > 
> > > Is there any reason python's printf-style formatting is missing the
> > > (C99) '%a' specifier?
> > 
> > Because it's not very well known or used? A google for "C printf
> > format string" gave lots of resources, none of which had %a.
> 
> They do if you search for "C99" instead of just "C".
> 
> Anyhow, another reason for not supporting "%a" is that it would be
> redundant.  It would be sufficent to define an "%x" format for floats.

I don't think that's a good idea: no other specifier is dual
integer/float, and you'd break code that passes floats to a %x
expecting it to work as a %u, but in hex.

Actually the answer I was expecting was "FooOS doesn't support it" or
somesuch, not 'uhhh... el qué?' :) %a is very useful for what it was
created: serializing floats without loss of precision, and I was
surprised that python didn't support it.

-- 
John Lenton (john at grulic.org.ar) -- Random fortune:
De los parientes y el sol, entre más lejos, mejor. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20040907/e6be3bf3/attachment.pgp>


More information about the Python-list mailing list