exit a program gracefully

2009-05-04 Thread Robert . T . Lynch
In a python program I ask if the user wants to continue. If they answer 'no', what options do I have to halt execution? I can put the rest of the code inside an "if bContinue:" block, but that seems awkward. I have looked at raising an exception, and perhaps this is the preferred method, but

multiply each element of a list by a number

2008-12-26 Thread Robert . T . Lynch
What does *not* work is 3 * [0,1,2] As you know, this gives [0,1,2,0,1,2,0,1,2] What I am hoping for is [0,3,6] I see that I can use numpy.multiply(3,range(3)) but this seems overkill to me. Can you tell I am coming to Python from Matlab? Thanks -- Rob-- http://