Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'argument': 0.05; 'tree': 0.05; 'attribute': 0.07; 'python3': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'mkdir': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'question': 0.24; 'skip:_ 20': 0.27; 'header:X-Complaints-To:1': 0.27; 'point': 0.28; 'appear': 0.29; "doesn't": 0.30; '"",': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'file': 0.32; 'linux': 0.33; 'url:python': 0.33; '(most': 0.33; 'skip:_ 10': 0.34; 'url:org': 0.36; 'url:library': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'url:3': 0.61; 'more': 0.64; 'anything.': 0.68; '2014,': 0.84; 'directories,': 0.84; 'serious': 0.97 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Peter Otten <__peter__@web.de> Subject: __import__(name, fromlist=...), was Re: Shuffle Date: Mon, 15 Sep 2014 16:30:50 +0200 Organization: None References: <5414F047.9030809@gmail.com> <5416f15e$0$30000$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Gmane-NNTP-Posting-Host: p57bdb20d.dip0.t-ipconnect.de User-Agent: KNode/4.13.3 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1410791470 news.xs4all.nl 2948 [2001:888:2000:d::a6]:58198 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77891 Steven D'Aprano wrote: > A serious question -- what is the point of the fromlist argument to > __import__? It doesn't appear to actually do anything. > > > https://docs.python.org/3/library/functions.html#__import__ It may be for submodules: $ mkdir -p aaa/bbb $ tree . └── aaa └── bbb 2 directories, 0 files $ python3 Python 3.4.0 (default, Apr 11 2014, 13:05:11) [GCC 4.8.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> __import__("aaa").bbb Traceback (most recent call last): File "", line 1, in AttributeError: 'module' object has no attribute 'bbb' >>> __import__("aaa", fromlist=["bbb"]).bbb