Nick Coghlan <ncogh...@gmail.com> added the comment:

One potential problem with the simple approach to fixing this is that up until 
now, string.Formatter has been thread safe. Because all the formatting state 
was held in local variables and passed around as method arguments, there was no 
state on the instance object to protect.

Now, this only applies if you start using the new feature, but it should be 
noted in the documentation and What's New that you need to limit yourself to 
accessing each formatter instance from a single thread.

It's also enough for me to say "no, not in a maintenance release".

Adding two attributes also seems unnecessary, and the pre-increment looks 
strange. Why not:

In __init__:
    auto_field_count = 0

Then as the auto numbering checking, something like:

    auto_field_count = self.auto_field_count
    if field_name:
        if auto_field_count > 0:
           # Can't switch auto -> manual
        auto_field_count = -1
    elif auto_field_count < 0:
       # Can't switch manual -> auto
    else:
        field_name = str(auto_field_count)
        self.auto_field_count += 1

(Alternatively, I'd ask the question: why do we prevent mixing manual numbering 
and explicit numbering anyway? It's not like it's ambiguous at all)

----------
nosy: +ncoghlan
versions:  -Python 2.7, Python 3.2

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13598>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to