m b wrote:


> >
> > if __name__ == "__main__":
> > main()

What does this mean?

/Mikael
__name__ is an attribute of the module. Usually it is set to the module name, except when the module is acutally executed as the entry point, in that case __name__ is set to '__main__'.

foo.py:
print __name__


> python foo.py
'__main__'

> python -c "import foo"
'foo'

This is a very basic concept, you should read the python tutorial.

JM

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

Reply via email to