The exported signature of `isprime` and `prime` is not useful
- Dominant language
- Julia
- Stars
- 282
- Forks
- 59
- PR merge metrics
- No merged PRs in 30d
Description
The exported signature of these two functions are
```julia
isprime(ex::SymbolicObject, args...; kwargs...)
prime(ex::SymbolicObject, args...; kwargs...)
```
However, from its python source code, `sympy.prime` only accepts integers, and errors if given expressions:
```julia
julia> sympy.prime(1)
2
julia> prime(1)
ERROR: MethodError: no method matching prime(::Int64)
Closest candidates are:
prime(::SymPy.SymbolicObject, ::Any...; kwargs...) at C:\Users\melonedo\.julia\packages\SymPy\4256i\src\importexport.jl:124
julia> @vars s
(s,)
julia> prime(s)
ERROR: PyError ($(Expr(:escape, :(ccall(#= C:\Users\melonedo\.julia\packages\PyCall\tqyST\src\pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw)))))
ValueError('s is not an integer',)
File "C:\Users\melonedo\.julia\conda\3\lib\site-packages\sympy\ntheory\generate.py", line 368, in prime
n = as_int(nth)
File "C:\Users\melonedo\.julia\conda\3\lib\site-packages\sympy\core\compatibility.py", line 425, in as_int
raise ValueError('%s is not an integer' % (n,))
```
`sympy.isprime` is only meaningful for integers, and returns false for expression:
```julia
julia> sympy.isprime(7)
true
julia> isprime(7)
ERROR: MethodError: no method matching isprime(::Int64)
Closest candidates are:
isprime(::SymPy.SymbolicObject, ::Any...; kwargs...) at C:\Users\melonedo\.julia\packages\SymPy\4256i\src\importexport.jl:109
julia> isprime(s)
false
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.