[Web-SIG] Client-side API

Simon Willison cs1spw at bath.ac.uk
Fri Oct 24 01:40:29 EDT 2003

Bill Janssen wrote:
> Another possibility would be to mimic the Java 1.4.1 libraries for the
> Web.  For instance, we could have the "URL" object, which has a method
> called "open()", which when called gives you a "Connection", which can
> be of subtype "HTTPConnection", "FTPConnection", etc.  Call the
> "create_request()" method on that "Connection" to get a new Request
> instance, use "set_header()", "set_cookie()", "set_body()", etc., then
> call the "send()" method, getting back a ReplyPromise instance, which
> can then be interrogated periodically to get a Reply instance, etc.

Ugh. One of the things I love about Python is that unlike Java it 
doesn't force you to have horribly verbose interfaces with dozens of 
different classes. A URL is a string, file-like-objects are 
file-like-objects and most of the modules in the standard library only 
make you deal with one or two classes and a few useful utility methods.

I'm all for replicating the capabilities of Java libraries (if they have 
a good bunch of features) but replicating the exact APIs seems to me 
like a lost opportunity to take advantage of Python's more expressive 


Simon Willison

More information about the Web-SIG mailing list