Stopping Execution
Steve Holden
steve at holdenweb.com
Thu Nov 10 20:13:49 EST 2005
Fredrik Lundh wrote:
> robert.dowell at gmail.com wrote:
>
>
>>import sys
>>sys.exit
>
>
> $ more test.py
> import sys
> print "should get here"
> sys.exit
> print "should never get here"
>
> $ python test.py
> should get here
> should never get here
>
Which is Fredrik's way of telling you you need to *call* sys.exit and
not just reference it (works in Perl, which assumes you want to call it,
but in Python "explicit is better than implicit").
$ more test.py
import sys
print "should get here"
sys.exit()
print "should never get here"
$ python test.py
should get here
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/
More information about the Python-list
mailing list