(20:53:06) TheSheep: Delfyn: instead of using those messages, I'd just rise an exception (20:53:18) TheSheep: Delfyn: and then catch it at the end (20:54:50) TheSheep: Delfyn: you can put the message in the exception object, so you don't even need globals then (20:55:38) Me: ok ... i didn't really understand python.org's explanation of try/except ... (20:55:59) Me: if i raise and error will the remaining code be executed or will it jump straight to the end? (20:56:08) Me: and=an (20:56:08) TheSheep: Delfyn: it will jump (20:56:17) Me: ah ... ok ... (20:56:32) TheSheep: Delfyn: it will also keep returning from funtions until the exception is caught (20:56:47) Me: err ... ? (20:56:59) TheSheep: suppose you have something like this: (20:57:11) Me: you mean that error *must* be explicity handled? (20:57:32) TheSheep: try: some_function(foo); print 'hello'; except SomeError: print "oops" (20:57:56) TheSheep: and you rise an exception SomeError inside some_function, but you don't catch it (20:58:28) TheSheep: then it will skip all the remaining code in some_function, skip the 'print "hello"', and stop where it is caught (20:58:35) TheSheep: then 'oops' will be printed (20:58:56) TheSheep: and the execution will resume from after the except block (20:59:01) Me: ahh ... okay, so the exception name space goes across function call boundaries (20:59:20) Me: and "SomeError" is just free text? (20:59:39) TheSheep: no, you want to make the exception itself a separate class (20:59:59) Me: why? (21:00:15) TheSheep: class SomeError: def __init__(self, message=""): self.message = message (21:00:29) TheSheep: and then do: except SomeError, e: print e.message (21:00:52) TheSheep: and when you raise, it, do: raise SomeError("oops!") (21:01:05) Me: okay, stop there ... (21:01:19) Me: i didn't really understand that but I've copied it and will try it :-) (21:01:31) TheSheep: you need to insert newlines and indetation (21:01:37) Me: clear