[Python-3000] stdlib reorganization
Jim Jewett
jimjjewett at gmail.com
Wed May 31 22:04:43 CEST 2006
On 5/31/06, Tim Hochberg <tim.hochberg at ieee.org> 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
More information about the Python-3000
mailing list