homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: urllib2: better import ftplib and gopherlib etc late
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: jhylton, jjlee, kxroberto, loewis, terry.reedy
Priority: normal Keywords:

Created on 2004年10月13日 09:41 by kxroberto, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Messages (5)
msg22670 - (view) Author: kxroberto (kxroberto) Date: 2004年10月13日 09:41
I've always trouble shrinking a py2exe'd package,
because of this. its also a speed issue. urllib2 is
most time used only with http(s) ...?
*** urllib2_old.py	Tue May 11 16:14:34 2004
--- urllib2.py	Wed Oct 13 11:32:44 2004
*************** f = urllib2.urlopen('http://www.python.o
*** 88,95 ****
 # check digest against correct (i.e. non-apache)
implementation
 
 import base64
- import ftplib
- import gopherlib
 import httplib
 import inspect
 import md5
--- 88,93 ----
*************** class FileHandler(BaseHandler):
*** 1009,1014 ****
--- 1007,1013 ----
 
 class FTPHandler(BaseHandler):
 def ftp_open(self, req):
+ import ftplib
 host = req.get_host()
 if not host:
 raise IOError, ('ftp error', 'no host given')
*************** class CacheFTPHandler(FTPHandler):
*** 1110,1115 ****
--- 1109,1115 ----
 
 class GopherHandler(BaseHandler):
 def gopher_open(self, req):
+ import gopherlib
 host = req.get_host()
 if not host:
 raise GopherError('no host given')
msg22671 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2004年10月15日 22:55
Logged In: YES 
user_id=593130
Since you have a patch, this should have been submitted as 
a patch rather than a bug. In any case, the patch needs to 
be submitted as separate file
msg22672 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2004年11月07日 14:42
Logged In: YES 
user_id=31392
I'd rather not move imports from their typical place for a
small performance chance in an unusual use case.
msg22673 - (view) Author: John J Lee (jjlee) Date: 2005年05月19日 20:38
Logged In: YES 
user_id=261020
Since Jeremy doesn't like the idea, this should probably be
closed, but:
Robert re-submitted this as patch 1053150.
msg22674 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006年05月11日 04:31
Logged In: YES 
user_id=21627
Closing this as out-of-date; it is replaced by #1484793.
History
Date User Action Args
2022年04月11日 14:56:07adminsetgithub: 41012
2004年10月13日 09:41:59kxrobertocreate

AltStyle によって変換されたページ (->オリジナル) /