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

Cameron Simpson cs at zip.com.au
Wed Oct 5 23:44:33 EDT 2011


On 03Oct2011 13:10, rantingrick <rantingrick at gmail.com> wrote:
| Also for scoping.
| 
| py> count = 0
| py> def foo():
| ...     global.count += 1
| py> print count
| 1
| 
| Why? Well because many times i find myself wondering if this or that
| variable is local or global -- and when i say "global" i am speaking
| of module scope! The "global<DOT>" cures the ill.

I must admit I rarely have this concern. My own module globals are
almost entirely CONSTANT type names. (Excluding function and class
names.) 

What's the common ambifuity case for you?
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

Generally, these things are dreadful, but I saw a clip the other night on tv
of someone who had built a scorpion costume for their spaniel, complete with
legs and a stinger.  It was quite impressive.  Made me want to run out and
buy a dog and a some foam rubber.       - David Farley



More information about the Python-list mailing list