Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
new NotImplementedOZero in misc
Browse files Browse the repository at this point in the history
  • Loading branch information
dkrenn committed Feb 11, 2016
1 parent aabd093 commit ea85895
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/sage/rings/asymptotic/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,3 +707,40 @@ def transform_category(category,
(category, A))

return result


class NotImplementedOZero(NotImplementedError):
r"""
A special :python:`NotImplementedError<library/exceptions.html#exceptions.NotImplementedError>`
which is raised when the result is O(0) which means 0
for sufficiently large values of the variable.
"""
def __init__(self, data):
r"""
INPUT:
- ``data`` -- an :class:`AsymptoticRing` or a string.
TESTS::
sage: A = AsymptoticRing('n^ZZ', ZZ)
doctest:...: FutureWarning: ...
sage: from sage.rings.asymptotic.misc import NotImplementedOZero
sage: raise NotImplementedOZero(A)
Traceback (most recent call last):
...
NotImplementedOZero: The result is O(0)
which means 0 for sufficiently large n
sage: raise NotImplementedOZero('something')
Traceback (most recent call last):
...
NotImplementedOZero: something
"""
from asymptotic_ring import AsymptoticRing
if isinstance(data, AsymptoticRing):
message = ('The result is O(0) which means 0 for sufficiently '
'large {}'.format(
', '.join(str(g) for g in data.gens())))
else:
message = data
super(NotImplementedOZero, self).__init__(message)

0 comments on commit ea85895

Please sign in to comment.