simon-git: spigot (master): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Fri Oct 20 07:41:15 BST 2017
TL;DR:
599bab2 Python: rename continued-fraction and base-digit functions.
8cb1657 Python: make spigot.from_* also spigot.Spigot.from_*.
Repository: https://git.tartarus.org/simon/spigot.git
On the web: https://git.tartarus.org/?p=simon/spigot.git
Branch updated: master
Committer: Simon Tatham <anakin at pobox.com>
Date: 2017-10-20 07:41:15
commit 599bab2190cf666b3b32b4f42eb041650c1c29d4
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=599bab2190cf666b3b32b4f42eb041650c1c29d4;hp=4e668b8c6e085b91db0869446134697e2e4a73dc
Author: Simon Tatham <anakin at pobox.com>
Date: Fri Oct 20 07:16:48 2017 +0100
Python: rename continued-fraction and base-digit functions.
I decided it was confusing that spigot.continued_fraction() constructs
a Spigot _from_ a generator of continued-fraction coefficients,
whereas given an actual spigot object 'sp', sp.continued_fraction()
converts it _to_ a similar generator. So now those two functions are
called from_cfrac() and to_cfrac() respectively (I also decided it was
better to make the names shorter rather than longer in the process).
Similarly, the cumbersome base_notation() function is now called
from_digits, and the old convergents() method is now to_convergents().
(Those two don't have literal inverse functions - at least not right
now - but it seems nicer to have them all conform to a more or less
consistent naming system.)
python/demo.py | 15 ++++++-------
python/powbegin.py | 2 +-
python/pythangle.py | 2 +-
python/spig/__init__.py | 14 ++++++------
python/testsuite.py | 58 ++++++++++++++++++++++++-------------------------
5 files changed, 45 insertions(+), 46 deletions(-)
commit 8cb1657f255d9d579f9e9d9784b46072f37ec5b5
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=8cb1657f255d9d579f9e9d9784b46072f37ec5b5;hp=599bab2190cf666b3b32b4f42eb041650c1c29d4
Author: Simon Tatham <anakin at pobox.com>
Date: Fri Oct 20 07:21:19 2017 +0100
Python: make spigot.from_* also spigot.Spigot.from_*.
The functions that construct a Spigot object from one or another kind
of input are conceptually a kind of Spigot constructor, even if
they're not invoked by the usual syntax of writing 'Spigot(args)'. So
it feels appropriate that they should be available as class methods on
the class they construct.
To arrange this conveniently, I've introduced a decorator that lets me
define a top-level function in the spigot module and simultaneously
make a class method of the same name in a given class.
python/spig/__init__.py | 11 +++++++++++
python/testsuite.py | 21 +++++++++++++++++++++
2 files changed, 32 insertions(+)
More information about the tartarus-commits
mailing list