Google to Host AJAX Libraries

By on

Google has announced that they are providing versioned hosting of the major AJAX libraries. Very cool! They’ll put the libraries on their servers, so they’re fast to access from anywhere in the world, and they promise to keep all versions going forward, so you can always get the one you want.

The big win, according to the article, is that browsers will already know that they have a version of a library if many apps use the same libraries from the same host. In that case, the browser won’t even have to download the library when the app requests it.

My favorite quote from the discussion: “Is this charity, or world domination?”

John

Why Python List Comprehensions Are Great

By on

So if you had the string

POST /wfs?request=Null&log&foo:bar=1,2:3,2:4,2&baz=x,y:y,z

and wanted to turn it into the list

['foo:bar:1,2', 'foo:bar:3,2', 'foo:bar:4,2', 'baz:x,y', 'baz:y,z']

How could you do it? Well, you could define a grammar & pass that into a parser… or you could have a pile or for loops…. Or, how about a triply-nested list comprehension contained within a reduce call? Like this!!!

reduce(operator.add,
[[(tag + ':' + value) for value in values.split(':')]
for (tag, values)
in [b.split('=') for b in a.split('&')[2:]]])