Skip to content

Commit d1f10f4

Browse files
committed
Add parent method to get the context
1 parent e50cda6 commit d1f10f4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/flint/types/_gr.pyx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,6 +1661,18 @@ cdef class gr(flint_scalar):
16611661
def __repr__(self):
16621662
return self.ctx.to_str(self)
16631663

1664+
def parent(self) -> gr_ctx:
1665+
"""
1666+
Return the parent context.
1667+
1668+
>>> from flint.types._gr import gr_complex_acb_ctx
1669+
>>> acb = gr_complex_acb_ctx.new(53)
1670+
>>> x = acb("pi")
1671+
>>> x.parent()
1672+
gr_complex_acb_ctx(53)
1673+
"""
1674+
return self.ctx
1675+
16641676
def is_zero(self):
16651677
"""Return whether the element is zero (may return ``None``).
16661678

0 commit comments

Comments
 (0)