Cool feature about Spyder

ruben.ciranni (4650 points)
7 13 31
asked Oct 29, 2021 in Programming in Python by ruben.ciranni (4,650 points)
recategorized Oct 30, 2021 by andrea.sterbini
I just found out a cool feature of Spyder and I wanted to share it:

When defining a function you can automatically generate a description of that function by specifying the types of the parameters and of the return value (For example ex(a: int, b: list) -> bool) and pressing enter twice.

That is really useful to always have under control the what the parameters and the returns of each function represent.
158 views

3 Answers

gabrimat (5520 points)
2 2 23
answered Oct 29, 2021 by gabrimat (5,520 points)
Thank you for sharing
Luigi Pizza (6080 points)
11 19 65
answered Oct 29, 2021 by Luigi Pizza (6,080 points)
Yes, but they are just a suggestion: Python will not check if a is an int or if b is a list, it is just to make the code easier to read.
ruben.ciranni (4650 points)
7 13 31
commented Oct 29, 2021 by ruben.ciranni (4,650 points)
Yes, it only generates a docstring which describes the function
KilianS (3460 points)
5 8 27
answered Oct 30, 2021 by KilianS (3,460 points)
i also thank you for sharing !