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

Chris Angelico rosuav at gmail.com
Wed Oct 5 09:10:26 EDT 2011


On Wed, Oct 5, 2011 at 11:57 PM, Roy Smith <roy at panix.com> wrote:
> In article <mailman.1737.1317798109.27778.python-list at python.org>,
>  Chris Angelico <rosuav at gmail.com> wrote:
>
>> Definitely. There's always a right time to do the wrong thing, just as
>> much as there's a wrong time to do the right thing. Even the
>> much-maligned goto has its place.
>
> Not in python, it doesn't :-)

The absence from the language doesn't prove that. All it means is
that, on those rare occasions when a goto would have been correct, the
programmer had to make do with something else :-)

How often do you see a loop structure that exists solely so someone
can 'break' out of it? Or, worse, raising an exception? I haven't seen
it in Python, but frequently in C or C++ code where the programmer had
a fixation on avoiding gotos.

ChrisA



More information about the Python-list mailing list