3 ms·
Modules and functions in Python have a __name__ attribute. If you've used Python for scripts, you've probably written `if __name__ == "__main__":` at some point
by typomatic 8y ago
Modules and functions in Python have a __name__ attribute. If you've used Python for scripts, you've probably written `if __name__ == "__main__":` at some point, which is the module name for executed scripts, whereas imported modules get their proper name.
Similarly, Python basically keeps track of "proper" names for proper functions, but can't/won't do so for lambdas.