Sascha Desch <sascha.de...@hotmail.com> added the comment:
That definition of `.parse()` definitely makes sense. Do you then think this is out of scope for `Formatter` in general or just for `.parse()`?. Just for reference, this is what I currently use to get automatic numbering to work for my use case. ``` def parse_command_template(format_string): auto_numbering_error = ValueError( 'cannot switch from automatic field numbering to manual field specification') index = 0 auto_numbering = None for literal_text, field_name, spec, conversion in Formatter().parse(format_string): if field_name is not None: if field_name.isdigit(): if auto_numbering is True: raise auto_numbering_error auto_numbering = False if field_name == '': if auto_numbering is False: raise auto_numbering_error auto_numbering = True field_name = str(index) index += 1 yield literal_text, field_name, spec, conversion ``` ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45704> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com