Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explicit string format as {name_:s} does not work #116

Open
martinResearch opened this issue Aug 13, 2020 · 5 comments
Open

explicit string format as {name_:s} does not work #116

martinResearch opened this issue Aug 13, 2020 · 5 comments
Labels
Milestone

Comments

@martinResearch
Copy link
Contributor

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 ?

@r1chardj0n3s
Copy link
Owner

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 :(

@martinResearch
Copy link
Contributor Author

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 ?

@r1chardj0n3s
Copy link
Owner

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.

@martinResearch
Copy link
Contributor Author

I see. Is that something you would want to do ?

@r1chardj0n3s
Copy link
Owner

Not really, but I think I'm going to have to ;-)

@r1chardj0n3s r1chardj0n3s added this to the 2.0 milestone Jan 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants