parse
parse copied to clipboard
explicit string format as {name_:s} does not work
Hi,
It seems that when specifying the format as :s in the formating string then parse does not work:
form = "test_{name:s}"
s = form.format(name="hello")# getting 'test_hello'
parse.parse(form , s) # getting None
Should we add a section elif type == 's': in _handle_field ?
Oof. Unfortunately, parse deviates from format for that one letter, s. In parse it means "whitespace". In format, when used, it means "the default string format".
I actually mis-read the format spec when writing parse and missed the mention of s :(
Ok. Maybe this behaviour could be controlled trough an new optional argument with default value set up to keep default behaviour unchanged to avoid breaking code that relies on it ?
I don't really like that as an option, as it will be very confusing. I think to fix it I'd need to make it a new major release which is backwards-incompatible in this one way.
I see. Is that something you would want to do ?
Not really, but I think I'm going to have to ;-)