Is it possible to create C-style "main" function in Python? (for teaching purposes)

Roy Smith roy at panix.com
Mon Oct 3 20:22:01 EDT 2011


In article <mailman.1702.1317670708.27778.python-list at python.org>,
 Ian Kelly <ian.g.kelly at gmail.com> wrote:

> It's not a good idea to teach bad habits they'll just have to unlearn
> later on.

Absolutely correct.  People who teach teachers how to teach call this 
the Law of Primacy 
(http://en.wikipedia.org/wiki/Principles_of_learning#Primacy), and 
(despite a lot of the religious psychobabble that comes with the 
territory) it really is true.  Much better to just say, "put this stuff 
at the end of your file and don't worry about it for now" then to teach 
people the wrong way to do things.

At some point, you'll get up to talking about modules and/or the magic 
double-underscore namespace.  Then you'll have the opportunity to double 
back and explain what it means.



More information about the Python-list mailing list