> wesley chun wrote:
>>
>> i have to resort to the uglier:
>> >>> 'dec: {0}/oct: 0o{0:o}/hex: 0X{0:X}'.format(i)
>> 'dec: 45/oct: 0o55/hex: 0X2D'


[Nick Coghlan <[EMAIL PROTECTED]>]:
> Is being explicit about the displayed prefix really that much uglier? The
> old # alternative display formats were somewhat arbitrary.

[Eric Smith <[EMAIL PROTECTED]>]:
> I don't see it as a big problem.  You can now use any prefix you want,
> instead of the hard coded values that # supplied.

based on both your replies, it sounds like it's going away!  :-)
no, i don't have a problem with it. however, it'd be nice to put
something about this in the PEP in case anyone else wonders/asks.


>> print format(10.0, "7.3g")

[Nick Coghlan <[EMAIL PROTECTED]>]:
> It works fine as written in 2.x :)
> (but, yes, you're right that as a 3000-series PEP, 3101 should probably
> treat print() as a function in its examples)

[Eric Smith <[EMAIL PROTECTED]>]:
> Fixed in r63786.  Thanks for catching it.  There was another print()
> function already in the PEP, so clearly the intent was to be 3.0 compliant.

another 2 suggestions then (only pick one):

1. if both str.format() and format() are going to be backported to
    2.x, there should be an example of it there too (see below where
    i'm also taking an additional liberty of changing "g" to "f"
    which i use more and give another number as an example):

    2.x:
    >>> print format(10.8765, '7.2f')
      10.88

    3.x:
    >>> print(format(10.8765, '7.2f'))
      10.88

2. drop the print altogether, esp. since this is about strings.

    >>> format(10.8765, '7.2f')
    '  10.88'

cheers,
-wesley
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to