Author anthon
Recipients anthon
Date 2015-09-08.19:23:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1441740193.79.0.679577096269.issue25034@psf.upfronthosting.co.za>
In-reply-to
Content
Since 3.4.1, string.Formatter() accepts empty keys {}. If these are nested they give different results from explicitly numbered, where the same arguments applied  "".format() give the expected results:

    from string import Formatter

    f = Formatter()

    fmt0 = "X {:<{}} {} X"
    fmt1 = "X {0:<{1}} {2} X"

    for fmt in [fmt0, fmt1]:
        x = f.format(fmt, 'ab', 5, 1)
        y = fmt.format(   'ab', 5, 1)
        print(x)
        print(y)
gives:

    X ab    5 X
    X ab    1 X
    X ab    1 X
    X ab    1 X
of which the first line is incorrect.
History
Date User Action Args
2015-09-08 19:23:13anthonsetrecipients: + anthon
2015-09-08 19:23:13anthonsetmessageid: <1441740193.79.0.679577096269.issue25034@psf.upfronthosting.co.za>
2015-09-08 19:23:13anthonlinkissue25034 messages
2015-09-08 19:23:13anthoncreate