From: Mark Wooding Date: Mon, 1 May 2017 00:38:30 +0000 (+0100) Subject: catacomb/__init__.py: Add printing for points on known curves. X-Git-Tag: 1.2.0~30 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/catacomb-python/commitdiff_plain/7a7aa30ed4de9656e32c951914f41f473fcadd58 catacomb/__init__.py: Add printing for points on known curves. Now the coordinates print correctly as field elements. --- diff --git a/catacomb/__init__.py b/catacomb/__init__.py index f943680..c646fe8 100644 --- a/catacomb/__init__.py +++ b/catacomb/__init__.py @@ -384,6 +384,16 @@ class _tmp: def __str__(me): if not me: return 'inf' return '(%s, %s)' % (me.x, me.y) + def _repr_pretty_(me, pp, cyclep): + if cyclep: + pp.text('...') + elif not me: + pp.text('inf') + else: + ind = _pp_bgroup(pp, '(') + pp.pretty(me.x); pp.text(','); pp.breakable() + pp.pretty(me.y) + pp.end_group(ind, ')') _augment(ECPtCurve, _tmp) ###--------------------------------------------------------------------------