Hi Navin, Thanks for replying. Yes your understanding is correct. Are you 100% certain that this mechanism is not available in Python.? I think this is very generic usecase of exception handling. !?
Thanks Nikunj -----Original Message----- From: bangpypers-bounces+nikunj.badjatya=emc....@python.org [mailto:bangpypers-bounces+nikunj.badjatya=emc....@python.org] On Behalf Of Navin Kabra Sent: Sunday, November 20, 2011 8:56 AM To: Bangalore Python Users Group - India Subject: Re: [BangPypers] "continue" in "try..except" On Sat, Nov 19, 2011 at 8:31 PM, Nikunj Badjatya <nikunjbadja...@gmail.com>wrote: > Can someone throw some light on this please. > If I understand right, this is what you want to do: Somewhere deep inside the "main" function, an exception is thrown. In the exception handler, if some condition is true, you want to say, "no, no, don't worry about the exception. please continue execution of main from the line after the exception". I don't think this can be done in python. You'll need to restructure your code instead. On Fri, Nov 18, 2011 at 7:23 PM, <nikunj.badja...@emc.com> wrote: > Hi , > > Please look at the below code snippet: > > {{{ > > if __name__ == "__main__": > try: > main() > except KeyboardInterrupt: > print("\nKeyboard interrupt from the user !!") > ret = input("Want to abort the installation ?[y/n]: ") > while True: > if ret == "y": > sys.exit(0) > elif ret == "n": > ## Want to continue the main() where it left of. > else: > > ret = input("Please enter either y/n : ") > > continue > > > > }}} > > > > In the "elif" block. I want to have a provision wherein "main()" would > > continue its execution where it left off. > > How can this be done.? > > > > Thanks > > Nikunj > > > > > > _______________________________________________ > > BangPypers mailing list > > BangPypers@python.org > > http://mail.python.org/mailman/listinfo/bangpypers > > > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > http://mail.python.org/mailman/listinfo/bangpypers > _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers