[Web-SIG] [stdlib-sig] Choosing one of two options for url* in the stdlib reorg

Brett Cannon brett at python.org
Fri Feb 29 23:21:29 CET 2008


On Fri, Feb 29, 2008 at 11:52 AM, M.-A. Lemburg <mal at egenix.com> wrote:
> On 2008-02-29 20:20, Brett Cannon wrote:
>  >>  So, I'd be +1 on the second approach, provided that those
>  >>  two classes make the transition into url.request as
>  >>  well. Otherwise, I'm +1 on the first approach and -1
>  >>  on the second.
>  >>
>  >
>  > Just to make sure I got this straight, as long as the two classes
>  > without the urllib._urlopener support from urlopen() are moved forward
>  > you are happy with this?
>
>  Yes.
>
>
>  > What about making urllib an external library people can download and
>  > install using distutils?
>
>  Well, removing urllib from the std lib doesn't mean that the module
>  is gone, but that's true for most modules in the std lib, right ?
>
>  The key argument for doing the std lib reorg - as I understand it -
>  was to be able to have a 2to3.py take care of changing the imports
>  in a script to make it work on 3.x.
>

Yes, as well as to clean out the cruft in the stdlib.

>  If you're now suggesting to move modules out of the way with no
>  option to automatically port them to 3.x, then you're going far
>  beyond that original intent.
>

No, the modules are already ported to 3.0. This has been done all
along in order for the test suite in Python to continue to work.
Making them external just means that if you want to use it in Python
3.0 you need to download the source and run the included setup.py to
install the module. Then 2to3 doesn't have to change anything as the
original urllib imports can just import the copy downloaded and
installed into site-packages. The only thing people would have to
contend with is a Py3KWarning stating that the module has been removed
from the stdlib but available for download from PyPI.

>  My main argument for keeping urllib logic in place is current
>  use of that module.

Right, which is why I asked if people thought the current usage was
small enough in terms of using things other than urlopen() that it
would be okay to pull it out. And giving people the option to download
and install a 3.0-compliant version would fill in the gap for anyone
else who still wants the code.

> If you look at Google code search (which only
>  scans OSS software and not even all of it), you get:
>
>  import urllib -urllib.py -test_urllib -urllib2
>         28,800 matches
>
>  + urllib.URLopener -FancyURLopener
>         300 matches
>
>  + urllib.FancyURLopener
>         700 matches
>
>  compared to:
>
>  import urllib2 -urllib2.py -test_urllib2
>         10,700 matches
>
>  + urllib2.Opener
>         300 matches
>
>  If you compare those results to searches for other modules
>  in the std lib, you'll find that those figures are high up
>  on the scale.

Right, but how many of those urlopen() calls are just urlopen("some
url"), which has a practical drop-in replacement from urllib2.

-Brett


More information about the Web-SIG mailing list