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

docs/numbers.rst : update parse_number comments #708

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 18 additions & 1 deletion docs/numbers.rst
Expand Up @@ -160,4 +160,21 @@ Examples:
...
NumberFormatError: '2,109,998' is not a valid decimal number

.. note:: Number parsing is not properly implemented yet
Note: as of version 2.8.0, the ``parse_number`` function has limited
functionality. It can remove group symbols of certain locales from numeric
strings, but may behave unexpectedly until its logic handles more encoding
issues and other special cases.

Examples:

.. code-block:: pycon

>>> parse_number('1,099', locale='en_US')
1099
>>> parse_number('1.099.024', locale='de')
1099024
>>> parse_number('123' + u'\xa0' + '4567', locale='ru')
1234567
>>> parse_number('123 4567', locale='ru')
...
NumberFormatError: '123 4567' is not a valid number