How to stop a running script inside a conditional statement?

asked 2018-04-25 14:59:50 +0200

anonymous user

Anonymous

Hello,

I have a sage script, say prg.sage inside which a conditional statement takes place. I would like the script to stop running if the condition is true after having called load("prg.sage") command, and still be in the sage environment. Pure python would allow me to use sys.exit()... What is the best way to do it the "sage way"?

edit retag flag offensive close merge delete

Comments

If the condition is part of a function def my_long_story(): then it is simplest to return at the wanted point. The caller takes then care what happens after this. It it is not, then write it so.

dan_fulea gravatar imagedan_fulea ( 2018-04-26 13:11:26 +0200 )edit