from ./.. import

Terry Reedy tjreedy at udel.edu
Sat Oct 5 01:47:02 EDT 2019


On 10/4/2019 9:01 AM, Hongyi Zhao wrote:
> Hi,
> 
> See this file:
> https://github.com/hongyi-zhao/dotbot/blob/master/dotbot/messenger/
> messenger.py
> 
> It has the following codes:
> 
> from ..util.singleton import Singleton
> from ..util.compat import with_metaclass
> from .color import Color
> from .level import Level
> 
> I just cannot figure out why they using the ``from ./.. import'' to
> import modules.

These are 'relative imports'.  Read the doc for import statements.


-- 
Terry Jan Reedy




More information about the Python-list mailing list