Inspecting Python Modules and Classes With “dir()” And “help()”
Loading advertisement...
Preload Image
Up next

The Most Natural Way to Increase Saturation and Enhance Color in Photoshop

Turn Off Light
Auto Next

Inspecting Python Modules and Classes With “dir()” And “help()”

How do I use a brand-new Python package? How do I find out what methods and classes the modules in this package provide? In this video you’ll see how to interactively explore Python modules and objects directly from the Python interpreter using the built-in “dir()” functions.

This is an underrated feature that’s easy to overlook, especially if you’re switching to Python from another language.

Many programming languages make it difficult to inspect what a package or class has to offer without consulting online documentation or learning interface definitions by heart.

Python is different—an effective developer will spend quite a bit of time in REPL sessions working interactively with the Python interpreter.

Show More