[Tutor] (no subject)

Amadeo Bellotti amadeo.bellotti at gmail.com
Thu Aug 17 19:28:56 CEST 2006


thank you Mr. Johnson this is my first program so its a little sloppy. I'm
using gedit ill check out the other editors that u have thank you

On 8/17/06, Kent Johnson <kent37 at tds.net> wrote:
>
> Amadeo Bellotti wrote:
> > Mr. Johnson i was hoping i didnt have to make my whole program into a
> > loop because its about 900 lines of code and tabbing that would take a
> > long time
> If your whole program is 900 lines without a subroutine then you have
> more problems than just tabbing...really, a program this big should have
> many functions to divide up the work. Looking for a workaround for poor
> program structure is not a good solution in the long run; fixing the
> program structure so it is workable is a better idea.
>
> As a practical matter, many editors allow you to select and indent a
> block, including TextPad and Eclipse, the two editors I usually use.
>
> Kent
>
> PS please reply to the list, not to me personally.
> >
> >
> >
> > On 8/17/06, *Kent Johnson* <kent37 at tds.net <mailto:kent37 at tds.net>>
> > wrote:
> >
> >     Amadeo Bellotti wrote:
> >     > hello is there a way if a condition is not met to restart the
> whole
> >     > program? for example if and if statement returns true then re
> start
> >     > the whole program?
> >
> >     You can probably achieve what you want just by structuring the
> >     program
> >     correctly. My guess you need to use nested loops, something like
> this:
> >
> >     while True:
> >       initialize_everything()
> >       while True:
> >         if something_is_wrong():
> >           break
> >         do_some_work()
> >
> >     This will do_some_work() until something_is_wrong(), then it will
> >     initialize_everything() and try again.
> >
> >     If the test for something_is_wrong() is buried deep in the code
> >     you can
> >     break the loop by raising an exception which you catch in the
> >     top-level
> >     loop.
> >
> >     Kent
> >
> >     _______________________________________________
> >     Tutor maillist  -  Tutor at python.org <mailto:Tutor at python.org>
> >     http://mail.python.org/mailman/listinfo/tutor
> >     <http://mail.python.org/mailman/listinfo/tutor>
> >
> >
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060817/8aadaf96/attachment-0001.html 


More information about the Tutor mailing list