Re: Link to module Stack

2010-01-09 Thread Dave Angel
Steven D'Aprano wrote: On Sat, 09 Jan 2010 05:56:36 -0500, Dave Angel wrote: "InnerInterpreterError" is the most inappropriate exception name I've ever seen. It has nothing to do with the interpreter, it's a stack error. It has everything to do with the (Forth) interpreter. Except

Re: Link to module Stack

2010-01-09 Thread Steve Holden
Steven D'Aprano wrote: > On Sat, 09 Jan 2010 05:56:36 -0500, Dave Angel wrote: > >>> "InnerInterpreterError" is the most inappropriate exception name I've >>> ever seen. It has nothing to do with the interpreter, it's a stack >>> error. >>> >>> >> It has everything to do with the (Forth) interpret

Re: Link to module Stack

2010-01-09 Thread Steven D'Aprano
On Sat, 09 Jan 2010 05:56:36 -0500, Dave Angel wrote: >> "InnerInterpreterError" is the most inappropriate exception name I've >> ever seen. It has nothing to do with the interpreter, it's a stack >> error. >> >> > It has everything to do with the (Forth) interpreter. Exceptions can > readily be

Re: Link to module Stack

2010-01-09 Thread Duncan Booth
Dave Angel wrote: > or even better, without the extra local var: > > def pop (self): > if len(self.__heap) == 0: > raise InnerInterpreterError, "stack underflow" > return self.__heap.pop(1) pop(1)? Anyway if would be simpler and almost certainly faster to not bo

Re: Link to module Stack

2010-01-09 Thread Dave Angel
Steven D'Aprano wrote: On Sat, 09 Jan 2010 01:07:39 -0800, kzagradskiy wrote: class Stack: def __init__(self): self.__heap = [] A "heap" has a technical meaning in programming. To describe the internals of a stack as "heap" will be disconcerting and confusing to anyone w

Re: Link to module Stack

2010-01-09 Thread Steven D'Aprano
On Sat, 09 Jan 2010 01:07:39 -0800, kzagradskiy wrote: > class Stack: > def __init__(self): > self.__heap = [] A "heap" has a technical meaning in programming. To describe the internals of a stack as "heap" will be disconcerting and confusing to anyone who knows about stacks and hea

Link to module Stack

2010-01-09 Thread kzagradskiy
Link to module Stack: http://groups.google.com/group/comp.lang.python/browse_thread/thread/e6a0668bb2be9a8e/64cb44a120baeca2?lnk=gst&q=stack+module#64cb44a120baeca2 Here's the stack module for py4th. nick --- #!/usr/Util/bin/python # # @(#)stack.py 1.1 # #