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

Add fields/interfaces for the numeric tower #49

Closed
jamadden opened this issue Aug 30, 2018 · 0 comments
Closed

Add fields/interfaces for the numeric tower #49

jamadden opened this issue Aug 30, 2018 · 0 comments
Assignees

Comments

@jamadden
Copy link
Member

Similar to #11 and its implementation in #47 where we added fields and interfaces for collections.Sequence, collections.MutableSequence, collections.Mapping andcollections.MutableMapping, I think it makes sense to have fields and interfaces for numbers.Number, numbers.Real, numbers.Rational and numbers.Integral.

In our own usage, we commonly parse data from JSON, and depending on the browser/client, we can get floats or ints for the same field, so we use a Number field that allows numbers.Number. But it's badly specified, what we really want is a numbers.Real field.

jamadden added a commit that referenced this issue Aug 30, 2018
In descending order of generality these are ``Number``, ``Complex``,
``Real``, ``Rational`` and ``Integral``. The ``Int`` class extends
``Integral``, the ``Float`` class extends ``Real``, and the
``Decimal`` class extends ``Number``.

Generalize the parsing of numbers in the Number class.

Add tests and document them.

Run the field and bootstrap field doctests as part of unittesting, not
just under tox with sphinx, and make them run on both Python 2 and 3.

Fixes #49
@jamadden jamadden self-assigned this Aug 30, 2018
jamadden added a commit that referenced this issue Aug 31, 2018
In descending order of generality these are ``Number``, ``Complex``,
``Real``, ``Rational`` and ``Integral``. The ``Int`` class extends
``Integral``, the ``Float`` class extends ``Real``, and the
``Decimal`` class extends ``Number``.

Generalize the parsing of numbers in the Number class.

Add tests and document them.

Run the field and bootstrap field doctests as part of unittesting, not
just under tox with sphinx, and make them run on both Python 2 and 3.

Fixes #49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant