On Apr 8, 3:54 pm, "M. Hamed" wrote:
> Thanks Patrick, that is what I was exactly looking for.
You're welcome!
But I have to say, you should consider what Paul and Lie are saying.
In general, when I use a stack, I just use append() and pop(), as they
mention, and let the list automagically keep
On 04/09/10 06:54, M. Hamed wrote:
> Thanks Patrick, that is what I was exactly looking for.
>
> Paul, thanks for your example. wasn't familiar with the stack class.
The stack class is nothing but a wrapper that renames append() to
push(); everything you need can be fulfilled by the regular list
Thanks Patrick, that is what I was exactly looking for.
Paul, thanks for your example. wasn't familiar with the stack class. I
feel Patrick's method is a lot simpler for my purpose.
Regards.
On Apr 8, 1:29 pm, Patrick Maupin wrote:
> On Apr 8, 3:21 pm, "M. Hamed" wrote:
>
>
>
> > I have troubl
On Apr 8, 3:21 pm, "M. Hamed" wrote:
> I have trouble with some Python concept. The fact that you can not
> assign to a non-existent index in an array. For example:
>
> a = [0,1]
> a[2] => Generates an error
>
> I can use a.append(2) but that always appends to the end. Sometimes I
> want t
On Apr 8, 3:21 pm, "M. Hamed" wrote:
> I have trouble with some Python concept. The fact that you can not
> assign to a non-existent index in an array. For example:
>
> a = [0,1]
> a[2] => Generates an error
>
> I can use a.append(2) but that always appends to the end. Sometimes I
> want t
I have trouble with some Python concept. The fact that you can not
assign to a non-existent index in an array. For example:
a = [0,1]
a[2] => Generates an error
I can use a.append(2) but that always appends to the end. Sometimes I
want to use this array as a stack and hence my indexing lo