On Thu, 8 Dec 2022 at 22:06, José Matos <jaoma...@gmail.com> wrote:

> On the same vein for 2.5 I intend to start, in an iterative process, to
> add type hinting to our python code: http://mypy-lang.org/
>
> One example:
>
> def fib(n):
>   if n==0 or n==1:
>     return 1
>   else:
>     return fin(n-1)+fib(n-2)
>
> becomes
>
> def fib(n: int) -> int:
>   if n==0 or n==1:
>     return 1
>   else:
>     return fin(n-1)+fib(n-2)
>
> The code works the same in both cases but we can use static type
> checking to ensure that functions are called as intended.
>
> This checking is not done at running time. Instead it can be run in a
> test stage, like pylint that Scott suggests.
>

The only problem I see with type hints is that it restricts the versions of
Python that can run the code. I believe that anything below 3.5
<https://lwn.net/Articles/640359/> won't be able to even parse the Python
code (which excludes 2.7). I understood that Python 2.7 should no longer be
supported with LyX 2.5, I don't remember anything about 3.x.
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to