Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Random832 Newsgroups: comp.lang.python Subject: Re: A mistake which almost went me mad Date: Mon, 07 Mar 2016 11:28:13 -0500 Lines: 14 Message-ID: References: <56d81044$0$19756$426a74cc@news.free.fr> <20160303054822.342fb513@bigbox.christie.dr> <20160303125053.79e95bde@bigbox.christie.dr> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de kwiNDaM7T7nXHew6hzgjQwiT5zW/TNfIqid+wTtylK9Q== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'imports': 0.09; 'received:internal': 0.09; 'subject:which': 0.09; 'worked,': 0.09; 'importing': 0.15; 'packages.': 0.15; 'cwd': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'sys.path': 0.16; 'wrote:': 0.16; 'case.': 0.18; 'absolute': 0.23; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'module': 0.25; "doesn't": 0.26; 'another.': 0.29; 'finds': 0.29; 'relative': 0.30; "can't": 0.32; 'maybe': 0.33; 'clear': 0.35; 'path': 0.35; 'should': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'received:66': 0.38; 'end': 0.39; 'why': 0.39; 'to:addr:python.org': 0.40; 'still': 0.40; 'your': 0.60; 'header:Message-Id:1': 0.61; 'mar': 0.65; 'statement,': 0.66; 'useful.': 0.72; 'besides,': 0.93 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=x+nxyy7sqEQ6UBrXthbm9G8FjIQ=; b=F9EU6g PXiVtKmfArMPBzEPR4hQB/K3G+0XDAL2qFcg1tLuhk5O0QV0sGFHtCkVVbOHJ5fo //88SWPaXfmqZ9fuxb5mZ42bwKqJWSPtWm2xpfd6oKt7PCGNNmGp9ayVJUny2/Zn k9SuNhBKZ09TjiYoNzhHQd6o2GikGRi3kBFf4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=x+nxyy7sqEQ6UBr Xthbm9G8FjIQ=; b=q00ZFSVIliPaMKGpqUovxyY8vz4KI7hFgtm4tMZQ6qX0kNX Be5JibMTsYoIAOqFPBAf1eCYCL8TUB0QtwqJxgr2hc9mDeu4xtK2Lmz16cjYHQMX Mabg3PyDZOxhhgLQ8FZfxTu5mTcflzZH7TRA6W9h7fNs/QrmUCYsiq7WKOEM= X-Sasl-Enc: iLME7NLH0QZamyk2/t7dv0FT2x/trUXykgfp8+anWqnj 1457368093 X-Mailer: MessagingEngine.com Webmail Interface - ajax-df15e059 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:104223 On Mon, Mar 7, 2016, at 11:19, Ian Kelly wrote: > Relative imports only work inside packages. You can't use a relative > import to import one top-level module from another. > > Besides, the relative import doesn't help to disambiguate in this > case. The absolute path of the stdlib email module is "email". The > absolute path of the module in your CWD is also "email". Why should a > relative import prefer one over the other? So I would think that even > if it worked, it would still just end up importing the first one it > finds on your sys.path. Maybe what we need is a system smarter than sys.path - a clear "import from stdlib" statement, and a way to designate what directories *contain stdlib modules*, would be useful.