Why do some functions have underscores “__” before and after the function name?

From the Python PEP 8 — Style Guide for Python Code: Descriptive: Naming Styles The following special forms using leading or trailing underscores are recognized (these can generally be combined with any case convention): _single_leading_underscore: weak “internal use” indicator. E.g. from M import * does not import objects whose name starts with an underscore. single_trailing_underscore_: … Read more