swcarpentry / python-novice-gapminder

Plotting and Programming in Python
http://swcarpentry.github.io/python-novice-gapminder/
Other
163 stars 427 forks source link

Discussion: cite functions with parentheses on lesson text? #542

Closed vinisalazar closed 3 years ago

vinisalazar commented 3 years ago

Functions are referred multiple times throughout the text of this lesson, whether they are built-in functions (e.g. Episode 04) or library functions (e.g. "Pass the name of the column to read_csv as its index_col parameter to do this. ").

I was thinking that maybe it would be nice to have all mentions to functions to be written by including the parentheses, e.g. print() instead of print, len() instead of len, and so on. Although passing a function without the parentheses to the interpreter is valid code, returning a function object, I considered that referring to them with parentheses throughout the text helps to reinforce the difference between functions and other objects, such as arguments, modules, and statements.

Are there any opinions on this? Or is there a reason for not using the parentheses?

Thanks, Vini

alee commented 3 years ago

Hi @vinisalazar thanks for all the issues and PRs!

Perhaps a distinct syntax highlighting style for functions would be preferable to including parentheses on all functions. Including the parentheses might also indicate that the function takes no arguments, or that you are dealing with a curried function etc. so I personally prefer just the name of the function to be invoked.

Another thing that may be a nice in-between would be to eventually convert all built-in references to actual references to that built-in in the Python docs. That's a larger job and one that could potentially be done programmatically though...