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

humanize.apnumber(0) should return zero #72

Closed
itemir opened this issue Apr 22, 2019 · 2 comments · Fixed by #121
Closed

humanize.apnumber(0) should return zero #72

itemir opened this issue Apr 22, 2019 · 2 comments · Fixed by #121
Labels
bug Something isn't working

Comments

@itemir
Copy link

itemir commented Apr 22, 2019

humanize.appnumber returns 0 for 0, while (I think) it should return 'zero':

>>> import humanize
>>> humanize.apnumber(0)
'0'
>>> humanize.apnumber(1)
'one'
>>> humanize.apnumber(2)
'two'
>>>
@itemir
Copy link
Author

itemir commented Apr 22, 2019

I just saw the following note in the code:

For numbers 1-9, returns the number spelled out. Otherwise, returns the number. This follows Associated Press style. This always returns a string unless the value was not int-able, unlike the Django filter.

I don't know why AP omitted zero but I think it makes sense to spell it out. That being said, feel free to close this if you think otherwise.

@hugovk hugovk added the bug Something isn't working label Mar 5, 2020
@hugovk
Copy link
Collaborator

hugovk commented Mar 5, 2020

Looking this up, apparently the Associated Press Stylebook (p. 203) says:

  • Spell out whole numbers up to (and including) nine (e.g., zero, one, 10, 96, 104).

https://apvschicago.com/2011/05/numbers-spell-out-or-use-numerals.html

Please see PR #121 to fix this.

Thanks for the report!

@itemir itemir closed this as completed Mar 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants