From: Mark Wooding Date: Sat, 23 Nov 2019 23:39:21 +0000 (+0000) Subject: catacomb/__init__.py: Prepare rational classes for upcoming changes. X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-python/commitdiff_plain/e127f835319e4b5e6dcdc2f0ed9a111a47fcecdf?hp=e127f835319e4b5e6dcdc2f0ed9a111a47fcecdf 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. ---