On Sun, 16 Aug 2020 10:12:04 +0200 Klaus Jantzen <k.d.jant...@mailbox.org> wrote:
> Hi, > > the other day I came across the book "Classic Computer Science > Problems in Python" by David Kopec. > > The function definitions in the examples like > > ===== > def fib2(n: int) -> int: > if n < 2: # base case > return n > return fib2(n - 2) + fib2(n - 1) # recursive case > > > if __name__ == "__main__": > print(fib2(5)) > print(fib2(10)) > > ===== > > use a syntax that I have never seen on this list or in other > publications. > What do you mean? The 'n:int' and '-> int'? If yes, this is type hinting. See here: https://docs.python.org/3/library/typing.html -- Manfred -- https://mail.python.org/mailman/listinfo/python-list