The release came with the classic what’s new document. Strangely missing from the documentation, however, is a new and undeniably useful feature added to
urllib. Back in the stone age of Python 2.4, you actually had to know the URL of whatever data you were retrieving with
urllib. That may be acceptable on Web 1.0, but then you might as well be writing Java. Here’s the new way to do it. About damned time if you ask me.
>>> import urllib >>> f = urllib.urlopen('miserable failure') >>> print f.geturl() http://www.whitehouse.gov/president/gwbbio.html
Other open source projects such as Firefox have already benefited from adding this functionality. Under the hood, this is just an I’m Feeling Lucky search, but all you have to know is that Python finally supports The Internet.
By the way, I was joking. But my joke comes with an implementation. Example usage:
>>> # Add these two magic lines: >>> import lucky >>> lucky.magic() >>> # Continue as before: >>> import urllib >>> f = urllib.urlopen('miserable failure') >>> print f.geturl() http://www.whitehouse.gov/president/gwbbio.html
(No, it’s not.)
Can you be given a ticket for not having windshield wipers on your car?