[Python-Dev] Thoughts on stdlib evolvement

David Stanek dstanek at dstanek.com
Tue Jun 7 13:09:26 CEST 2005


On Mon, Jun 06, 2005 at 01:38:36PM -0500, Skip Montanaro wrote:
> 
> 
>     Reinhold> - Flat namespace: Should we tend to a more hierarchic library
>     Reinhold>   (e.g.  inet.url, inet.http, inet.nntp)? This would increase
>     Reinhold>   clarity when searching for a module.
> 
> We've talked about this before.  The main technical challenge seems to be
> backward compatibility.  You need to support both flat ("import urllib") and
> packaged namespaces ("from www import urllib"), possibly within the same
> application.  That is, postulating a www package, if I execute
> 
>     import urllib
>     from www.urllib import urlopen
> 
> the module-level code should only be executed once, and
> 
>     urlopen == urllib.urlopen
> 
> should evaluate to True.

Can't this be handled with an __init__ module? Create an inet package
and having the __init__ module pull whatever it wanted into it's own
namespace.

It would be nice to then use warnings to show deprecation messages
when the old import is used (import url instead of import inet.url),
but I don't think that is quite so easy.

-- 
David Stanek
www.roninds.net

GPG keyID #6272EDAF on http://pgp.mit.edu
Key fingerprint = 8BAA 7E11 8856 E148 6833  655A 92E2 3E00 6272 EDAF
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-dev/attachments/20050607/0d897c63/attachment.pgp


More information about the Python-Dev mailing list