Skip to content

Commit d57c646

Browse files
committed
Move docstring for __call__() to eval()
1 parent 09b51bd commit d57c646

File tree

1 file changed

+11
-20
lines changed

1 file changed

+11
-20
lines changed

cypari2/gen.pyx

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3849,7 +3849,11 @@ cdef class Gen(Gen_base):
38493849
>>> f(3) == f.eval(3)
38503850
True
38513851
3852-
Evaluating power series:
3852+
>>> f = pari('Mod(x^2 + x + 1, 3)')
3853+
>>> f(2)
3854+
Mod(1, 3)
3855+
3856+
Evaluating a power series:
38533857
38543858
>>> f = pari('1 + x + x^3 + O(x^7)')
38553859
>>> f(2*pari('y')**2)
@@ -3952,25 +3956,6 @@ cdef class Gen(Gen_base):
39523956
[x^2 + 1, [0, 1], -4, 1, [Mat([1, 0.E-38 + 1.00000000000000*I]), [1, 1.00000000000000; 1, -1.00000000000000], [1, 1; 1, -1], [2, 0; 0, -2], [2, 0; 0, 2], [1, 0; 0, -1], [1, [0, -1; 1, 0]], [2]], [0.E-38 + 1.00000000000000*I], [1, x], [1, 0; 0, 1], [1, 0, 0, -1; 0, 1, 1, 0]]
39533957
>>> nf(x='y')
39543958
[y^2 + 1, [0, 1], -4, 1, [Mat([1, 0.E-38 + 1.00000000000000*I]), [1, 1.00000000000000; 1, -1.00000000000000], [1, 1; 1, -1], [2, 0; 0, -2], [2, 0; 0, 2], [1, 0; 0, -1], [1, [0, -1; 1, 0]], [2]], [0.E-38 + 1.00000000000000*I], [1, y], [1, 0; 0, 1], [1, 0, 0, -1; 0, 1, 1, 0]]
3955-
"""
3956-
return self(*args, **kwds)
3957-
3958-
def __call__(self, *args, **kwds):
3959-
"""
3960-
Evaluate ``self`` with the given arguments.
3961-
3962-
This has the same effect as :meth:`eval`.
3963-
3964-
Examples:
3965-
3966-
>>> from cypari2 import Pari
3967-
>>> pari = Pari()
3968-
3969-
>>> f = pari('Mod(x^2 + x + 1, 3)')
3970-
>>> f.type()
3971-
't_POL'
3972-
>>> f(2)
3973-
Mod(1, 3)
39743959
39753960
Tests:
39763961
@@ -3998,6 +3983,12 @@ cdef class Gen(Gen_base):
39983983
...
39993984
TypeError: cannot evaluate PARI t_INT using unnamed arguments
40003985
"""
3986+
return self(*args, **kwds)
3987+
3988+
def __call__(self, *args, **kwds):
3989+
"""
3990+
Evaluate ``self`` with the given arguments. See ``eval``.
3991+
"""
40013992
cdef long t = typ(self.g)
40023993
cdef Gen t0
40033994
cdef GEN result

0 commit comments

Comments
 (0)