On 11/18/2013 3:13 PM, John Ladasky wrote:

Of course, I have used __name__ for years in the common expression "if __name__ == 
"__main__") to determine whether a particular module is being run or merely imported.

This true statement invalidates your subject line ;-). All modules have a __name__. The main module has the name (__name__) '__main__'. (A file named '__main__.py' also has special meaning. If one does 'python -m package' on a command line and 'package' is a directory with '__init__.py', 'package/__main__.py' is executed as the main module '__main__'.

1. WHY do only callable objects get a __name__?

Why do you think this? Is there a mistake in the doc?

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to