Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #77088
| References | (1 earlier) <mailman.13475.1409078833.18130.python-list@python.org> <5a9b5715-382b-4a6b-be90-c535ad14740a@googlegroups.com> <b92274f5-6ed8-451a-b01a-0874a1048b54@googlegroups.com> <c64eh8F4jkuU1@mid.individual.net> <53fd1fd3$0$30001$c3e8da3$5496439d@news.astraweb.com> |
|---|---|
| Date | 2014-08-27 10:18 +1000 |
| Subject | Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.13482.1409098740.18130.python-list@python.org> (permalink) |
On Wed, Aug 27, 2014 at 10:01 AM, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > Gregory Ewing wrote: > >> Although shadowing builtin module names is never a good >> idea, either! > > /s/builtin/standard library/ > > Quick! Name all the standard library modules, stat! > > In Python 3.3, there are something like 410 modules in the standard library. > There's a reasonable chance that you've shadowed at least one but never > noticed. Yet. Not sure about that figure; any that are namespaced away in packages don't count (or rather, they count as just one, for the package itself). But yes, there are a lot. > I think it is a serious design flaw that the standard library and user code > co-exist in a single namespace. There are two concerns here. One is that if you create a "random.py", you can't yourself import the normal random module; and the other is the possibility that some unrelated application like Idle can be affected. I think the latter is far more serious than the former, which is basically equivalent to using "id" as a variable name and then finding you've shadowed a builtin (it affects only your current module, so it's pretty safe). But if I can create stuff that breaks Idle, that's a problem. And I think the solution to that is simply: never put your files onto the module search path, always just use the current directory. It might also be worth having some tools like Idle remove "" from sys.path, in case someone invokes it from a project directory, but that's an arguable point. (That's probably more useful for something like 2to3, where it's expected that you'll run it from a project directory. And maybe that already happens.) The only other way to separate them would be to do something like C's include paths - you have the user include path (which starts with the current directory) and the system include path (which doesn't), and then you can #include "local_file.h" and #include <system_file.h> to get the one you want. In Python, that could be done as "import random from system", which would then look up sys.systempath instead of sys.path - but do we really need that functionality? ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Twirlip2 <ahrodg@googlemail.com> - 2014-08-26 11:01 -0700
Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Terry Reedy <tjreedy@udel.edu> - 2014-08-26 14:46 -0400
Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Twirlip2 <ahrodg@googlemail.com> - 2014-08-26 12:20 -0700
Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Twirlip2 <ahrodg@googlemail.com> - 2014-08-26 12:44 -0700
Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Twirlip2 <ahrodg@googlemail.com> - 2014-08-26 12:58 -0700
Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-26 21:15 +0100
Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-08-27 10:03 +1200
Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Twirlip2 <ahrodg@googlemail.com> - 2014-08-26 15:55 -0700
Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Twirlip2 <ahrodg@googlemail.com> - 2014-08-27 08:25 -0700
Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-27 10:01 +1000
Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Twirlip2 <ahrodg@googlemail.com> - 2014-08-26 17:06 -0700
Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Chris Angelico <rosuav@gmail.com> - 2014-08-27 10:18 +1000
Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-27 00:20 +0100
Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Twirlip2 <ahrodg@googlemail.com> - 2014-08-26 16:29 -0700
Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Terry Reedy <tjreedy@udel.edu> - 2014-08-26 20:51 -0400
Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Twirlip2 <ahrodg@googlemail.com> - 2014-08-26 18:11 -0700
Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Terry Reedy <tjreedy@udel.edu> - 2014-08-27 00:03 -0400
Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Twirlip2 <ahrodg@googlemail.com> - 2014-08-27 02:12 -0700
Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Twirlip2 <ahrodg@googlemail.com> - 2014-08-26 12:26 -0700
Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-08-26 14:46 -0500
Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Grant Edwards <invalid@invalid.invalid> - 2014-08-26 18:59 +0000
Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Chris Angelico <rosuav@gmail.com> - 2014-08-27 09:07 +1000
Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Twirlip2 <ahrodg@googlemail.com> - 2014-08-26 16:25 -0700
Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what? Chris Angelico <rosuav@gmail.com> - 2014-08-27 09:42 +1000
Python conquors the BBC [was Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-27 10:04 +1000
Re: Python conquors the BBC [was Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?] Twirlip2 <ahrodg@googlemail.com> - 2014-08-26 17:08 -0700
Re: Python conquors the BBC [was Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?] Chris Angelico <rosuav@gmail.com> - 2014-08-27 10:21 +1000
Re: Python conquors the BBC [was Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?] Twirlip2 <ahrodg@googlemail.com> - 2014-08-26 17:58 -0700
Re: Python conquors the BBC [was Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?] Twirlip2 <ahrodg@googlemail.com> - 2014-08-26 18:06 -0700
Re: Python conquors the BBC [was Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?] Chris Angelico <rosuav@gmail.com> - 2014-08-27 12:36 +1000
Re: Python conquors the BBC [was Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?] Rustom Mody <rustompmody@gmail.com> - 2014-08-26 20:13 -0700
Re: Python conquors the BBC [was Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?] Chris Angelico <rosuav@gmail.com> - 2014-08-27 14:55 +1000
Re: Python conquors the BBC [was Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?] Twirlip2 <ahrodg@googlemail.com> - 2014-08-27 01:50 -0700
Re: Python conquors the BBC [was Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?] Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2014-08-27 10:12 +0200
Re: Python conquors the BBC [was Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?] Twirlip2 <ahrodg@googlemail.com> - 2014-08-27 02:04 -0700
csiph-web