[Tutor] Traversing python datatypes via http

Tiger12506 keridee at jayco.net
Wed Feb 6 02:03:02 CET 2008


> Is it possible to traverse say python lists via http://
>
> say there is a list in the memory
>
> can we traverse the list using list/next list/prev list/first list/last
>
> is there a pythonic library to do that?
>
> thanks

That's a very unlikely request. There are a few ways to interpret this 
question I will cover the obvious (to me) ones.

Q1) Can I use the http protocol in such a way to make requests of a remote 
computer to send me elements of a list that is stored in memory on the 
remote computer?
A1) Yes, but an http server is required that knows how to respond to these 
requests, and knows how to send the correct information. There are standard 
modules to make programming servers easier.

Q2) Can I use other protocols (not specifically http)?
A1) Yes, it would make more sense to use something other than http because 
http is meant to follow strict guidlines that really aren't applicable to 
the problem as I have interpreted it. In this case, there are modules that 
can help in communication using sockets.

Q3) I want to know how to find the answer to the linked list problem in the 
Python Challenges. Can I do this using http:// and python?
A3) Of course. The module urllib is specifically meant for downloading web 
pages and can be used for the linked list challenge.

Q4) Excellent. Can I use it to give me the last element in the list, thus 
skipping all the guesswork in between and giving me the solution right away?
A4) No. By its very nature, a linked list (not python specific btw) has to 
be traversed element by element. That means using urllib and opening each 
page as it is presented to your program.

Q5) No you're totally off-base. I meant, can I download a list of web pages, 
where all of the addresses are stored in a python list?
A5) Of course. urllib

Q6) No this doesn't cover anything that I am asking.
A6) Please structure your question in a more precise manner. Thank you. Have 
a nice day.

;-) 



More information about the Tutor mailing list