[Tutor] REPL format

Steven D'Aprano steve at pearwood.info
Sun Apr 26 06:28:04 CEST 2015


On Sat, Apr 25, 2015 at 04:38:33PM -0700, Jim Mooney wrote:
> I'm curious why, when I read and decode a binary file from the net in one
> fell swoop, the REPL prints it between parentheses, line by line but with
> no commas, like a defective tuple.

What REPL are you using? I can't reproduce what you are 
reporting in the standard Python 3.3 interactive interpreter. When I 
print the transit_info I get a single block of text:


'<?xml version="1.0"?>\r\n\r\n ... </buses>\r\n'

which my terminal then wraps over multiple lines.


> I can see breaking lines visually, at
> \n, but if the parentheses don't mean anything I can't see including them.
> Or do they mean something I've missed? Also, it's interesting that although
> HTML is case-free, you have to get the case right for the java server page.
> getbusesforroute.jsp doesn't work.

That has nothing to do with HTML.

HTML is a file format, and it is case-insensitive. <b> and <B> are the 
same tag. But the http protocol has nothing to do with the contents of 
the files. When you give a URL like:

http://ctabustracker.com/bustime/map/getBusesForRoute.jsp?route=22

parts of it are case-insensitive and parts may not be.

The domain part:

    ctabustracker.com

is handled by the DNS system, and is case-insensitive. You could write 
http://cTaBuStRaCkEr.CoM/ if you like, and it would give you the same 
result.

But the part after the domain is controlled by the web server for that 
domain, and that depends on the web server. Some web servers may choose 
to be case-insensitive. Others may be case-sensitive. The local part of 
the URL that follows the domain is under control of the web server, 
which could do anything it likes.


-- 
Steve


More information about the Tutor mailing list