python - Correct way to gracefully exit code prematurely from any section -


i have bunch of threads, classes, methods, , loops. in each level have pass, check, , handle global variable causes section of code exit before completing it's task if user wants exit program early.

every time-dependent section literally wrapped in if not quit_now(): (or similar). cannot code-fu - there better way?


Comments

Popular posts from this blog

many to many - Django Rest Framework ManyToMany filter multiple values -

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

Java Entity Manager - JSON reader was expecting a value but found 'db' -