Newbie trying to understand __name__=='__main__'

Dan Schmidt dfan at harmonixmusic.com
Mon Sep 18 15:47:14 EDT 2000


"Luc Lefebvre" <lefebvre at med.mcgill.ca> writes:

| class Set:
      .
      .
      .
|     if __name__=='__main__':
|         x=Set([1,2,3,4])

You're putting that if statement inside the class, which seems really
odd.  I don't know if it's even legal.  Try taking the 'main' part of
your program (the 'if' and everything after it), and outdenting it
back to column 1, at the 'top level'.

-- 
                 Dan Schmidt | http://www.dfan.org
Honest Bob CD now available! | http://www.dfan.org/honestbob/cd.html



More information about the Python-list mailing list