A Q. on pop().

spencer infotechsys at pivot.net
Fri Mar 18 11:21:09 EST 2005


Hi,
The code.

def buildStackMajor():
    for node in dirStackMinor:
        #print 's is the node...', node
        dirStackMajor.append(node)
        dirStackMinor.pop()
        print 'POP the stack...', len(dirStackMinor)
        print 'after pop...', dirStackMinor

When I start the "for" loop I have 11 members in 
the stack- a list. The pop() is poping member
from the back, as though it's deal with a LIFO
stack instead of LIFO. I never get pass a length
of 5.
first Q.. Why is pop() starting from the back
          back of the stack?
second Q.. Why can't I never empty the stack?
Thanks. 




More information about the Python-list mailing list