Traversing python datatypes via http

Alan Gauld alan.gauld at btinternet.com
Tue Feb 5 19:25:23 EST 2008


"Mark" <mobiledreamers at gmail.com> wrote

> Is it possible to traverse say python lists via http://

http is a network protocol.
What does that have to do with traversing python lists?
Can you clarify what you mean by that?

> say there is a list in the memory
> can we traverse the list using list/next list/prev list/first 
> list/last

Not with a standard list although its not hard to do by defining
your own class wrappibng a list.

You can however traverse a list using a standard for loop:

for item in [1,2,3,4,5]:
    print item

And you can use range() to generate a set of indices
that will allow you to iterate by more unusual step sizes
And you can use normal indexing to go to the first element(0)
or the last element(-1)

I'm not sure if that answers your question.

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 





More information about the Python-list mailing list