With the old import system, and a package that looks like this:

foo/
  __init__.py
  main.py
  bar/
    __init__.py
    baz.py

If I wanted to delay importing baz until it was actually used, I could
leave the __init__.py files empty and simply "import bar.baz".
However, with the new relative imports syntax, "from . import bar.baz"
causes a syntax error. I could use something like "from .bar import
baz as bar_baz", but that's long, annoying to write, and requires
changing all the uses of "bar.baz.spam" to "bar_baz.spam" through the
file. Is there any way to achieve the "bar.baz" name with relative
imports?
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to