"raise" becomming a function in py3k?
Over on the voidspace blog, there is a little discussion about raising an exception in a lambda. Because raise is a statement, it's kind of a hard thing to do. Raising an exception as an expression that is. Which "raises" the question, why isn't raise a function in py3k? The two suggestions on how to raise in an expression were these: >>> r = lambda: eval(compile("raise RuntimeError", '', 'exec')) >>> r() >>> ctypes.pythonapi.PyErr_SetObject(*map(ctypes.py_object, (e.__class__, e))) Which are kind of both a bit yuk. So maybe raise could be a bit more expressive in py3k?