Skip to content

Glossary: Coding Interviews

if __name__ == "__main__":

Also written: __name__, __main__

A Python idiom that runs code only when the file is run directly, not when another file imports it. It lets tests import your functions without printing the report.

Where the book teaches it

Related terms

pytestTake-home