[issue36701] module 'urllib' has no attribute 'request'

2019-04-23 Thread Brett Cannon
Brett Cannon added the comment: I'm -1 on pulling `request` up to implicitly be part of the `urllib` namespace without an import. `os.path` is the only exception that I know of in the stdlib and that's historical (it predates packages existing in the language). Otherwise the proposed change

[issue36701] module 'urllib' has no attribute 'request'

2019-04-23 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +brett.cannon ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36701] module 'urllib' has no attribute 'request'

2019-04-23 Thread Martin Panter
Martin Panter added the comment: The “urllib” package also contains “urllib.parse”, which is a lot more lightweight than “urllib.request”. In a quick experiment, importing “urllib.request” is more than 2 times slower than importing “urllib.parse” on its own. And importing “urllib” by itself

[issue36701] module 'urllib' has no attribute 'request'

2019-04-23 Thread Berker Peksag
Berker Peksag added the comment: What about other packages in the stdlib? For example, you can see the same behavior in the email package: >>> import email >>> email.message.EmailMessage() Traceback (most recent call last): File "", line 1, in AttributeError: module 'email' has no

[issue36701] module 'urllib' has no attribute 'request'

2019-04-23 Thread Senthil Kumaran
Senthil Kumaran added the comment: I vaguely recollect the reason for this. It was done with the translation of Python2 code (which had urllib, urllib2, and urlparse, robotparser) etc, combined into a single package. We wanted to keep the import as urllib.request and urllib.response, and

[issue36701] module 'urllib' has no attribute 'request'

2019-04-23 Thread Piyush
New submission from Piyush : The current way to use one of `urllib.request` APIs is like this: ``` import urllib.request urllib.request.urlretrieve ``` Can we change this to: ``` import urllib urllib.request.urlretrieve ``` This will require adding 1 line at