[Python-Dev] Another relative imports question

Chris Withers chris at simplistix.co.uk
Fri Oct 8 10:50:20 CEST 2010


Hi All,

The new explicit relative import syntax is great.
I wanted to relatively import a module.

import .mymoduleinmypackage

...and got a SyntaxError in Python 2.6.

I guess I need to do:

from . import mymoduleinmypackage

...but it does feel weirdly asymetric that:

from .mymoduleinmypackage import something

...while:

import .mymoduleinmypackage
mymoduleinmypackage.something

...does not.

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
             - http://www.simplistix.co.uk


More information about the Python-Dev mailing list