swcarpentry / python-novice-gapminder

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

Built-in Functions and Help Lesson: add get the methods attached to an object using the dir() #624

Closed pageneck closed 1 year ago

pageneck commented 1 year ago
I am suggesting that you may consider adding to the lesson material under the subtopic below the dir(name_object) to get the methods attached to that object: Functions attached to objects are called methods Functions take another form that will be common in the pandas episodes. Methods have parentheses like functions, but come after the variable. Some methods are used for internal Python operations, and are marked with double underlines. The dir() function returns all properties and methods of the specified object, without the values. This function will return all the properties and methods, even built-in properties which are default for all object.
vahtras commented 1 year ago

Thank you for your contribution! I agree that it is good to know about dir(). However, is a similar explanation in another episode (8), so I don't think it is required at this particular place.

Regards Olav