[IronPython] Use of sys.exit
Michael Foord
fuzzyman at voidspace.org.uk
Wed Nov 19 21:25:43 CET 2008
Marty Nelson wrote:
>
> We have users writing extension scripts that execute from C#, and may
> be called multiple times (for example, hooked up to a Change event of
> some object or event in the main application)
>
>
>
> Is sys.exit(1) an acceptable way for them to exit the script (used
> like an early return in C#)? Is there a better way? Does it do
> anything to the ScriptScope that is reused?
>
It would seem acceptable - it raises the SystemExit exception which your
hosting application would need to catch and ignore.
A better structured way (in my opinion) would be to use a procedural or
object oriented approach in the scripts and allow them to terminate
normally.
Michael Foord
>
>
> Thanks!
>
>
>
>
>
> =======
> Notice: This e-mail message, together with any attachments, contains
> information of Symyx Technologies, Inc. or any of its affiliates or
> subsidiaries that may be confidential, proprietary, copyrighted,
> privileged and/or protected work product, and is meant solely for
> the intended recipient. If you are not the intended recipient, and
> have received this message in error, please contact the sender
> immediately, permanently delete the original and any copies of this
> email and any attachments thereto.
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog
More information about the Ironpython-users
mailing list