[issue45704] string.Formatter.parse does not handle auto-numbered positional fields

2021-11-05 Thread Sascha Desch
Sascha Desch 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

[issue45704] string.Formatter.parse does not handle auto-numbered positional fields

2021-11-03 Thread Sascha Desch
Sascha Desch added the comment: Another thing that occurred to me is the question of what `.parse()` should do when a mix of auto-numbered and manually numbered fields is supplied e.g. `{}{1}`. As of now `.parse()` happily processes such inputs and some other piece of code deals with this

[issue45704] string.Formatter.parse does not handle auto-numbered positional fields

2021-11-03 Thread Sascha Desch
Sascha Desch added the comment: Yes it should return a string containing the index of the positional argument i.e. `"0"` so that it is compatible with `.get_field()`. Side note: It's a somewhat weird that `.get_field` expects a string while `.get_value` expects an int

[issue45704] string.Formatter.parse does not handle auto-numbered positional fields

2021-11-03 Thread Sascha Desch
New submission from Sascha Desch : It appears when adding auto-numbered positional fields in python 3.1 `Formatter.parse` was not updated to handle them and currently returns an empty string as the field name. ``` list(Formatter().parse('hello {}')) # [('hello ',