swcarpentry / python-novice-gapminder

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

Change the variable name "sum" to "summatory" #512

Closed AbrahamAvelar closed 3 years ago

AbrahamAvelar commented 3 years ago

As "sum" is a built-in function, it is better to name this variable something different.

vahtras commented 3 years ago

A practice that is not uncommon is to append an underscore to a variable name that conflicts with a built-in, e.g. in this case sum_.

AbrahamAvelar commented 3 years ago

I agree that cumulativesum or total may be better. sum is good too but I think may be confussing to novices. Anyways I believe the important thing is to change the original name from the lesson as it is confussing, even more as in the method sum() is used in the "Writing Functions" episode. When running sequencially, the error comes from python trying to use it as a variable name. How do we get the change in the SC lesson?

alee commented 3 years ago

I agree that cumulativesum or total may be better. sum is good too but I think may be confussing to novices. Anyways I believe the important think is to change the original name from the lesson as it is confussing, even more as in the method sum() is used in the "Writing Functions" episode. When running sequencially, the error comes from python trying to use it as a variable name. How do we get the change in the SC lesson?

If you're OK with cumulative_sum or total I'd be happy to merge after renaming summatory -> cumulative_sum - you can do this by adding another commit to your PR branch. Let us know if you need help with it, and thanks again for the PR!