Currently, the biggest problem for the type checker is that Cython is not
emitting any type annotations, so pratically all cython classes are `any`
(which is probably also the reason why the Integer return value is not
flagged). For now, one would need to generate the `pyi` stub files (using
so
Hi, all,
I think I understand what’s going wrong, but I don’t understand how to fix the
following problem:
sage: K.=NumberField(x^2-10)
sage: OK=K.maximal_order()
sage: O=ZZ[a]
sage: a in OK
True
sage: a in K
True
sage: a in O
True
sage: O.index_in(OK)
---
I tried using mypy, and I also just ran "sage --tox -e pyright", and
neither seems to flag the conflict between the signature "def
signature(self) -> Integer:" and the output, which is some arithmetic with
"len(...)" and hence a Python int. (And both mypy and pyright produce a ton
of warnings,
On Wednesday, September 6, 2023 at 11:02:15 AM UTC-7 Dima Pasechnik wrote:
Should we run mypy on all the *.py files, at least, in our CI?
We already have "sage --tox -e pyright", which is considered a better
choice than mypy.
We are also running it in the GitHub CI as part of the Build & Test
On Wed, 6 Sept 2023 at 18:24, John H Palmieri wrote:
>
> For a while now, Python has allowed return types to be specified in
> signatures:
>
> def f() -> int:
>
> It is my understanding that this doesn't actually do any error-checking or
> type-checking — see https://docs.python.org/3/librar
Yes, one need mypy, most probably.
E.g.
$ pip install mypy --user
$ cat t.py
def f() -> float:
return "hello"
$ mypy t.py
t.py:2: error: Incompatible return value type (got "str", expected "float")
[return-value]
Found 1 error in 1 file (checked 1 source file)
No idea how it plays with c
For a while now, Python has allowed return types to be specified in
signatures:
def f() -> int:
It is my understanding that this doesn't actually do any error-checking or
type-checking — see https://docs.python.org/3/library/typing.html. So this
works without error:
def f() -> float: