Re: Question about raise and exceptions.

2007-03-01 Thread Ben Finney
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > On 1 mar, 04:46, Daniel Klein <[EMAIL PROTECTED]> wrote: > > Thanks for setting me straight. I had (wrongly) thought that the > > stuff inside of () was a tuple. > > For the record, it's the ',' that makes the tuple. The () are (in > this context

Re: Question about raise and exceptions.

2007-03-01 Thread [EMAIL PROTECTED]
On 1 mar, 04:46, Daniel Klein <[EMAIL PROTECTED]> wrote: > On Wed, 28 Feb 2007 22:03:13 +0100, Bruno Desthuilliers > > > > <[EMAIL PROTECTED]> wrote: > >Daniel Klein a écrit : > >> The arguments for TransitionError must be a tuple, > > >Err... > > >> eg: > > >> msg = "Going to error state %d from s

Re: Question about raise and exceptions.

2007-02-28 Thread Daniel Klein
On Wed, 28 Feb 2007 22:03:13 +0100, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >Daniel Klein a écrit : >> The arguments for TransitionError must be a tuple, > >Err... > >> eg: >> >> msg = "Going to error state %d from state %d" % (self.curr_state, >> newstate) >> raise TransitionError(self,

Re: Question about raise and exceptions.

2007-02-28 Thread Bruno Desthuilliers
Ben Finney a écrit : (snip) > The syntax of the 'raise' statement requires one, two, or three > arguments, all of which instruct 'raise' what to do, and none of which > refer to arguments given to the exception instance. Not quite. If the first argument is a class and the second argument is not a

Re: Question about raise and exceptions.

2007-02-28 Thread Bruno Desthuilliers
Steven W. Orr a écrit : > On Wednesday, Feb 28th 2007 at 22:03 +0100, quoth Bruno Desthuilliers: > > =>Daniel Klein a ?crit : > =>> On Wed, 28 Feb 2007 13:48:54 -0500 (EST), "Steven W. Orr" > =>> <[EMAIL PROTECTED]> wrote: > =>> > =>> > =>>>When I run it I get this: > =>>> > =>>>884 > ./t_fsm.py

Re: Question about raise and exceptions.

2007-02-28 Thread Steven W. Orr
On Wednesday, Feb 28th 2007 at 22:03 +0100, quoth Bruno Desthuilliers: =>Daniel Klein a ?crit : =>> On Wed, 28 Feb 2007 13:48:54 -0500 (EST), "Steven W. Orr" =>> <[EMAIL PROTECTED]> wrote: =>> =>> =>>>When I run it I get this: =>>> =>>>884 > ./t_fsm.py =>>>Traceback (most recent call last): =>>>

Re: Question about raise and exceptions.

2007-02-28 Thread Ben Finney
"Steven W. Orr" <[EMAIL PROTECTED]> writes: > In my class I have I assume you mean "in my module", since you're showing us several classes. > class TransitionError(Error): > [...] > def __init__(self, previous, next, message): Here you define the arguments that must be passed when

Re: Question about raise and exceptions.

2007-02-28 Thread Bruno Desthuilliers
Daniel Klein a écrit : > On Wed, 28 Feb 2007 13:48:54 -0500 (EST), "Steven W. Orr" > <[EMAIL PROTECTED]> wrote: > > >>When I run it I get this: >> >>884 > ./t_fsm.py >>Traceback (most recent call last): >> File "./t_fsm.py", line 3, in ? >>from fsm import * >> File "/home/boston/VIASAT/sorr

Re: Question about raise and exceptions.

2007-02-28 Thread Daniel Klein
On Wed, 28 Feb 2007 13:48:54 -0500 (EST), "Steven W. Orr" <[EMAIL PROTECTED]> wrote: >When I run it I get this: > >884 > ./t_fsm.py >Traceback (most recent call last): > File "./t_fsm.py", line 3, in ? > from fsm import * > File "/home/boston/VIASAT/sorr/py/fsm/fsm.py", line 76 > raise

Question about raise and exceptions.

2007-02-28 Thread Steven W. Orr
In my class I have class Error(Exception): """Base class for exceptions in this module.""" pass class TransitionError(Error): """Raised when an operation attempts a state transition that's not allowed. Attributes: previous -- st