catacomb/__init__.py: Prepare rational classes for upcoming changes.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 23 Nov 2019 23:39:21 +0000 (23:39 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 25 Nov 2019 17:51:31 +0000 (17:51 +0000)
commite127f835319e4b5e6dcdc2f0ed9a111a47fcecdf
treea65d5b0582cb1e6ddee3c2b998dd28a7397c1ec0
parentef6b951620d6e2f581bbe8d7eff42e3d8d6cf508
catacomb/__init__.py: Prepare rational classes for upcoming changes.

In the near future, we won't be able to guarantee that all rings allow
implicit conversions of (integer) 0 and 1 to the additive and
multiplicative ring identities, so:

  * define `ZERO' and `ONE' class attributes on the concrete classes to
    hold the respective ring identities;

  * make the `_split_rat' function into a private method of the
    `BaseRat' class and adjust callers to match;

  * compare against `ZERO' to detect an exact element of the base ring;
    and

  * return `ONE' as the implicit denominator for a base-ring element or
    foreign object to be converted.

No functional change.
catacomb/__init__.py