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

Alan Meyer ameyer2 at yahoo.com
Tue Oct 4 21:22:42 EDT 2011


On 10/4/2011 9:07 PM, Alan Meyer wrote:

> ... and to write up a comparison of the pros and cons of the global and
> no-global approaches.  ...

Of course you'll need to be fair in evaluating the students comparisons. 
  Some bright students are likely to come up with good reasons for using 
globals in some situations, and they might even be right.  Or if they're 
not completely right, they might nevertheless be partly right.  They 
should get high marks for that.

You could even make up an exercise where the students are assigned to 
write a program that uses a global that could NOT be better implemented 
without globals.  Then ask one or two of the authors of the better 
programs to defend their programs in front of the class.

It's always a mistake to read student papers with preconceived, set in 
concrete ideas about what's right and what's wrong.  Many years ago when 
I was teaching (philosophy, not computer science), in every class I 
taught there was always at least one student who taught me something I 
didn't know, or taught me that something I thought I knew was wrong.

     Alan



More information about the Python-list mailing list