Ian Kelly wrote:

I would suggest giving them the whole if __name__ block as boilerplate
and telling them they're not allowed to alter it.

I would suggest not showing them "if __name__" at all;
instead encourage them to do this:

  def main():
    ...
    ...

  main()

You only need "if __name__ == '__main__'" if you want
a .py file that can be used as either a module or a
main program. Most of the time you *don't* need that.
I consider it advanced usage that beginners shouldn't
be confused with.

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

Reply via email to