chiark
/
gitweb
/
~mdw
/
catacomb-python
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
fd60c6b
)
catacomb/__init__.py: Add printing for points on known curves.
author
Mark Wooding
<mdw@distorted.org.uk>
Mon, 1 May 2017 00:38:30 +0000
(
01:38
+0100)
committer
Mark Wooding
<mdw@distorted.org.uk>
Thu, 4 May 2017 11:06:00 +0000
(12:06 +0100)
Now the coordinates print correctly as field elements.
catacomb/__init__.py
patch
|
blob
|
blame
|
history
diff --git
a/catacomb/__init__.py
b/catacomb/__init__.py
index f9436802e5a360da1a7ebcf973596efeb2abaa0b..c646fe8c2f4ec843706f816a4d6404f1adba8449 100644
(file)
--- 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)
###--------------------------------------------------------------------------