On 5/31/06, Tim Hochberg <[EMAIL PROTECTED]> wrote:

> However, wx currently, and presumably for the forseeable future, lives
> in site packages, so we'd actually have something like:
>
>      from site.gui import wx
>      from site.gui import pygui
>      from py.gui import tkinter

> That seems confusing and suboptimal.

Requiring the "site" or "py" or "__main__" prefix is indeed suboptimal.

Puttting it in the module's cached name so that you can tell where it
came from is useful.

Note that one common use case is evaluating (or using) a package that
is distributed both in the stdlib and separately.

    import logging             # I don't care where you get it.
    import py.logging          # Get the stdlib version; it is
sufficient and I tested with it
    import site.logging        # Get the version used by this sysadmin
(with her config tweaks)
    import .utils.logging      # Get a version distributed with this program


>      >>> import gui
>      >>> dir(gui)
>      ['wx', 'tkinter', 'pygui']

Note that wx, tkinter, and pygui are probably not in the same
directory.  I *think* this is the primary use case behind namespace
packages.

-jJ
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to