Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Tim Chase Newsgroups: comp.lang.python Subject: Re: A mistake which almost went me mad Date: Thu, 3 Mar 2016 12:50:53 -0600 Lines: 28 Message-ID: References: <56d81044$0$19756$426a74cc@news.free.fr> <20160303054822.342fb513@bigbox.christie.dr> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de PjX6mAN3SUBvEqfum+22RAGx11bQeHVDId3ANw5zKfNw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'installed.': 0.05; 'benjamin': 0.09; 'imports': 0.09; 'subject:which': 0.09; '(and,': 0.16; '-tkc': 0.16; '2016': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'naming': 0.16; 'nick': 0.16; 'received:10.21': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'smtplib': 0.16; 'somehow.': 0.16; 'to:name:python list': 0.16; 'wrote:': 0.16; 'first.': 0.18; 'language': 0.19; 'student': 0.20; 'prevent': 0.20; '2.x': 0.22; 'import': 0.24; 'somewhere': 0.24; 'tim': 0.24; 'header:In-Reply-To:1': 0.24; 'module': 0.25; 'script': 0.25; "i've": 0.25; 'correct': 0.28; 'chase': 0.29; 'crash': 0.29; 'implicitly': 0.29; "i'm": 0.30; 'creating': 0.30; 'relative': 0.30; 'fixed': 0.31; 'usually': 0.33; 'surprised': 0.33; 'too': 0.36; 'should': 0.36; 'modules': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'being': 0.37; 'turn': 0.37; 'charset:us-ascii': 0.37; 'doing': 0.38; 'version': 0.38; 'names': 0.38; 'to:addr:python.org': 0.40; 'easy': 0.60; 'collection': 0.60; 'times': 0.63; 'march': 0.64; 'forced': 0.84; 'oscar': 0.84; 'received:23': 0.84; 'mistake': 0.91; 'novice': 0.93 X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-MC-Relay: Neutral X-MailChannels-SenderId: wwwh|x-authuser|tim@thechases.com X-MailChannels-Auth-Id: wwwh X-MC-Loop-Signature: 1457031230940:1451057223 X-MC-Ingress-Time: 1457031230940 In-Reply-To: X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) X-AuthUser: tim@thechases.com 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:103994 On 2016-03-03 16:29, Oscar Benjamin wrote: > On 3 March 2016 at 11:48, Tim Chase > wrote: > > On 2016-03-03 10:43, Nick Sarbicki wrote: > >> The number of times I've had to correct a student for naming > >> their script "turtle.py". > >> > >> And the number of times I've caught myself doing it... > > > > I'm surprised at the number of times I find myself creating an > > "email.py" DESPITE KNOWING BETTER EVERY SINGLE TIME. > > This mistake is too easy to make and should be fixed in the language > somehow. There's no way that a novice user can know which module > names are implicitly "reserved" by being used somewhere in the > stdlib or the collection of 3rd party modules that they may happen > to have installed. I think that relative imports should ameliorate this, as I usually hit it when I'm using smtplib which in turn imports "email" (and, in 2.x when it found my local email.py would crash and burn). If it used a relative import that forced it to find the one in the stdlib, it should(?) prevent it from finding my local version first. -tkc