Request for feedback on my first Python program
Ben Finney
bignose-hates-spam at and-zip-does-too.com.au
Fri May 30 03:38:41 EDT 2003
On Thu, 29 May 2003 23:14:45 -0700, Scott Meyers wrote:
> I'm a C++ programmer who's writing his very first Python program.
Glad to see you've come across to try the waters here, Scott. Those
of us who grew up on your C++ books were wondering when you'd show :-)
Before I try debugging your code:
> # if this language had a main(), it'd be here...
This is done in Python with:
if( __name__ == '__main__' ):
stuff_to_do_when_called_as_a_script()
This promotes reuse of *.py files as modules, since the same file can be
either run as a script or 'import'ed.
--
\ "Probably the earliest flyswatters were nothing more than some |
`\ sort of striking surface attached to the end of a long stick." |
_o__) -- Jack Handey |
http://bignose.squidly.org/ 9CFE12B0 791A4267 887F520C B7AC2E51 BD41714B
More information about the Python-list
mailing list