Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #20096

Re: Apparent "double imports" (was: Naming convention for in-house modules (Newbie question))

References <jguajb$mqe$1@news.albasani.net> <jh0jrb$2lb$1@news.univ-fcomte.fr> <mailman.5589.1328798215.27778.python-list@python.org> <jh14o2$6j6$1@news.albasani.net>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2012-02-09 12:02 -0700
Subject Re: Apparent "double imports" (was: Naming convention for in-house modules (Newbie question))
Newsgroups comp.lang.python
Message-ID <mailman.5603.1328814154.27778.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Feb 9, 2012 at 11:53 AM, HoneyMonster <someone@someplace.invalid> wrote:
> One issue I have run into, which may or may not be a problem: I am
> finding that modules in the in-house "library" package sometimes have to
> import modules like sys and os, which are also imported by the "calling"
> module. Is this a problem or an overhead, or does it just result in two
> names for the same object?

Two names for the same object.  When a module is imported, the module
object is stored in the sys.modules dict.  Further imports of the same
module just return the same module object from sys.modules.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Naming convention for in-house modules (Newbie question) HoneyMonster <someone@someplace.invalid> - 2012-02-08 17:15 +0000
  Re: Naming convention for in-house modules (Newbie question) Chris Rebert <clp2@rebertia.com> - 2012-02-08 09:49 -0800
  Re: Naming convention for in-house modules (Newbie question) Laurent Claessens <moky.math@gmail.com> - 2012-02-09 15:00 +0100
    Re: Naming convention for in-house modules (Newbie question) Arnaud Delobelle <arnodel@gmail.com> - 2012-02-09 14:36 +0000
      Re: Naming convention for in-house modules (Newbie question) Laurent Claessens <moky.math@gmail.com> - 2012-02-09 18:42 +0100
      Apparent "double imports" (was: Naming convention for in-house modules (Newbie question)) HoneyMonster <someone@someplace.invalid> - 2012-02-09 18:53 +0000
        Re: Apparent "double imports" (was: Naming convention for in-house modules (Newbie question)) Ian Kelly <ian.g.kelly@gmail.com> - 2012-02-09 12:02 -0700
          Re: Apparent "double imports" (was: Naming convention for in-house modules (Newbie question)) HoneyMonster <someone@someplace.invalid> - 2012-02-09 19:40 +0000
            Re: Apparent "double imports" Dave Angel <d@davea.name> - 2012-02-09 15:05 -0500
              Re: Apparent "double imports" HoneyMonster <someone@someplace.invalid> - 2012-02-09 21:57 +0000

csiph-web