jaraco/inflect

inconsistency in handling spaces

オープン

#26 opened on 2015/07/28

 (3 件のコメント) (0 件のリアクション) (0 人の担当者)Python (125 件のフォーク)github user discovery
featurehelp wanted

Repository metrics

Stars
 (1,082 個のスター)
PR merge metrics
 (30d に merged PR はありません)

説明

>>> p.number_to_words('11 11')
'one thousand, one hundred and eleven'
>>> p.ordinal(11)
'11th'
>>> p.ordinal('11 ')
'11 th'
>>> p.ordinal('11  ')
'11  th'
>>> p.ordinal('11 11')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ssara29/others/Abin/src/inflect/inflect.py", line 2797, in ordinal
    n = int(num)
ValueError: invalid literal for int() with base 10: '11 11'

While number_to_words is removing all intervening spaces, ordinal ain't doing the same. Why the inconsistency? Why isn't number_to_words complaining about the space?

コントリビューターガイド