Re: Stack experiment

2007-04-03 Thread tom
Ok, I got it running. Thank you! I removed the space and top of that I had foul indentation in return statement. I'll try the approaches you suggest. -- http://mail.python.org/mailman/listinfo/python-list

Re: Stack experiment

2007-04-03 Thread kyosohma
On Apr 3, 11:17 am, Steve Holden <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Hi! Im new to Python and doing exercise found from internet. It is > > supposed to evaluate expression given with postfix operator using > > Stack() class. > > > class Stack: > > def __init__(self): > >

Re: Stack experiment

2007-04-03 Thread Steve Holden
[EMAIL PROTECTED] wrote: [...] > > Steve, > > How do you do "tokenList = split(expr)"? There is no builtin called > "split". > > Mike > Sorry, that should have been a call to the .split() method of expr, i.e.: tokenList = expr.split() regards Steve -- Steve Holden +44 150 684 7255

Re: Stack experiment

2007-04-03 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Hi! Im new to Python and doing exercise found from internet. It is | supposed to evaluate expression given with postfix operator using | Stack() class. | | class Stack: | def __init__(self): | self.items = [] | | def pus

Re: Stack experiment

2007-04-03 Thread Richard Brodie
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> There is a stray leading space in it. > > Nah, I'd say there's a stray ([^0-9]) after the space. If you regard the spaces as being a required part of the postfix grammar, it would be simpler. But who would design a language where wh

Re: Stack experiment

2007-04-03 Thread Matimus
On Apr 3, 8:57 am, [EMAIL PROTECTED] wrote: > Hi! Im new to Python and doing exercise found from internet. It is > supposed to evaluate expression given with postfix operator using > Stack() class. > > class Stack: > def __init__(self): > self.items = [] > > def push(self, item):

Re: Stack experiment

2007-04-03 Thread irstas
On Apr 3, 7:14 pm, "Richard Brodie" <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> wrote in message > >There may be something wrong with the "re" code in your example, > >but I don't know enough about that to help in that area. > > There is a stray leading space in it. Nah, I'd say there's a str

Re: Stack experiment

2007-04-03 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Hi! Im new to Python and doing exercise found from internet. It is > supposed to evaluate expression given with postfix operator using > Stack() class. > > class Stack: > def __init__(self): > self.items = [] > > def push(self, item): > sel

Re: Stack experiment

2007-04-03 Thread Richard Brodie
<[EMAIL PROTECTED]> wrote in message >There may be something wrong with the "re" code in your example, >but I don't know enough about that to help in that area. There is a stray leading space in it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Stack experiment

2007-04-03 Thread kyosohma
On Apr 3, 10:57 am, [EMAIL PROTECTED] wrote: > Hi! Im new to Python and doing exercise found from internet. It is > supposed to evaluate expression given with postfix operator using > Stack() class. > > class Stack: > def __init__(self): > self.items = [] > > def push(self, item)

Re: Stack experiment

2007-04-03 Thread irstas
[EMAIL PROTECTED] wrote: > Hi! Im new to Python and doing exercise found from internet. It is > supposed to evaluate expression given with postfix operator using > Stack() class. > > class Stack: > def __init__(self): > self.items = [] > > def push(self, item): > self.i

Stack experiment

2007-04-03 Thread tom
Hi! Im new to Python and doing exercise found from internet. It is supposed to evaluate expression given with postfix operator using Stack() class. class Stack: def __init__(self): self.items = [] def push(self, item): self.items.append(item) def pop(self):