Skip to content

readme: Clarify 'd' type#198

Merged
wimglenn merged 1 commit intor1chardj0n3s:masterfrom
dreua:patch-2
Dec 16, 2024
Merged

readme: Clarify 'd' type#198
wimglenn merged 1 commit intor1chardj0n3s:masterfrom
dreua:patch-2

Conversation

@dreua
Copy link
Copy Markdown
Contributor

@dreua dreua commented Dec 15, 2024

In my understanding of the word "digits" the signs + or - would not be matched. That is indeed not the case, you can prefix your numbers with + (optional) or - and it gets matched and converted as one would expect it.

Feel free to treat this as an issue report and reword it in a different way, this is just my attempt to make it more clear.

Thanks for the cool library! ❤️

@dreua
Copy link
Copy Markdown
Contributor Author

dreua commented Dec 15, 2024

Just played around with this some more:

>>> parse.parse("a{:d}sdf{:D}", "a-023sdfasdf")
<Result (-23, 'asdf') {}>
>>> parse.parse("{:D}{:d}sdf{:D}", "a-023sdfasdf")
<Result ('a-', 23, 'asdf') {}>

Now the sign lands in :D which is as documented but may be surprising nevertheless. Well in the end one must take more care when parsing than formatting I guess.

@wimglenn wimglenn merged commit a497a40 into r1chardj0n3s:master Dec 16, 2024
@dreua dreua deleted the patch-2 branch December 16, 2024 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants