Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!hq-usenetpeers.eweka.nl!hq-usenetpeers.eweka.nl!bcyclone04.am1.xlned.com!bcyclone04.am1.xlned.com!newsfeed.xs4all.nl!newsfeed3a.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'scripts': 0.03; 'subject:Python': 0.06; '(using': 0.07; 'correct.': 0.07; 'explicit': 0.07; 'paths': 0.07; '*is*': 0.09; 'already.': 0.09; 'bash': 0.09; 'feature,': 0.09; 'interpreted': 0.09; 'sure,': 0.09; 'wrong,': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'language,': 0.12; "wouldn't": 0.14; '23,': 0.16; '3.3,': 0.16; '5:30': 0.16; 'bash,': 0.16; 'brilliant': 0.16; 'does,': 0.16; 'exist.': 0.16; 'fork': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'haskell,': 0.16; 'hint:': 0.16; 'massively': 0.16; 'naming': 0.16; 'paths.': 0.16; 'problems!': 0.16; 'subject:dependencies': 0.16; 'subject:import': 0.16; 'java,': 0.16; 'language': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'bit': 0.19; 'properly': 0.19; "skip:' 30": 0.19; '>>>': 0.22; 'programming': 0.22; 'import': 0.22; 'putting': 0.22; 'cc:addr:python.org': 0.22; "aren't": 0.24; 'certainly': 0.24; 'module,': 0.24; 'unicode': 0.24; 'cc:2**0': 0.24; 'compiled': 0.26; 'first,': 0.26; 'right.': 0.26; 'this:': 0.26; 'world,': 0.26; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'chris': 0.29; "doesn't": 0.30; 'designer': 0.30; 'see,': 0.30; 'message- id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; "i'm": 0.30; 'usually': 0.31; '(maybe': 0.31; 'accidentally': 0.31; 'agreed.': 0.31; 'are.': 0.31; "d'aprano": 0.31; 'go.': 0.31; 'implicit': 0.31; 'obscure': 0.31; 'pascal': 0.31; 'steven': 0.31; 'file': 0.32; 'there.': 0.32; 'languages': 0.32; 'running': 0.33; 'alone': 0.33; 'beginning': 0.33; 'actual': 0.34; 'maybe': 0.34; 'subject:the': 0.34; 'could': 0.34; 'common': 0.35; 'except': 0.35; 'something': 0.35; 'etc': 0.35; 'no,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'google': 0.35; 'there': 0.35; 'himself': 0.36; "didn't": 0.36; 'useful': 0.36; 'possible': 0.36; 'should': 0.36; 'wrong': 0.37; 'so,': 0.37; 'being': 0.38; 'system,': 0.38; 'nov': 0.38; 'skip:[ 10': 0.38; 'pm,': 0.38; 'though,': 0.39; 'either': 0.39; 'easy': 0.60; 'subject:"': 0.60; 'most': 0.60; "you're": 0.61; 'making': 0.63; 'guarantee': 0.63; 'show': 0.63; 'name': 0.63; 'pick': 0.64; 'more': 0.64; 'world': 0.66; 'here': 0.66; 'production': 0.68; 'therefore': 0.72; 'special': 0.74; "else's": 0.84; 'nice,': 0.84; 'shadow': 0.84; 'subject:history': 0.84; 'inefficient': 0.91; 'to:none': 0.92; 'rick': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=jvCj2c2Z1BF+16KpifLGkLD40YNbeKuzVQYlLD9/Prk=; b=kOrkiDo0jcVtAv0/DILTgaGaV8HGXQp/eTpeVISn5S8NetMaj/D+e7gbPfNQM6yGOk ngdZCkSYWy4OdudznFHXOzfeM4Wx2wANcJt2xmWthLefcBTjUSbhL1IqJg9DwjJ6qF9y FgM7btC34lFu82D+UOB5mtSB6Si9jNWpqt4ZOoWqPbamB6BZ2x0pSZOYEZ5eGHBuzyyk 3d4oMoxM9EykWP6YbhHdL1N/k4a+BkqvHihIRVDBvdKD8/31zU0TeApIVJIl6NeZCbPp P8t2+9Ky3NMe/DrkjFb4qFDOTEN3RDPwaZqV0eSgFqrR2ytRYH3wiLwpAL6u0ZeuPFSE xHCA== MIME-Version: 1.0 X-Received: by 10.50.79.135 with SMTP id j7mr6070248igx.14.1416725778752; Sat, 22 Nov 2014 22:56:18 -0800 (PST) In-Reply-To: <54717eeb$0$12992$c3e8da3$5496439d@news.astraweb.com> References: <066c46c8-a04d-4489-b15a-b603c1b1818b@googlegroups.com> <8661e407-4472-4208-97c2-f666f6502c67@googlegroups.com> <547080a0$0$12981$c3e8da3$5496439d@news.astraweb.com> <54717eeb$0$12992$c3e8da3$5496439d@news.astraweb.com> Date: Sun, 23 Nov 2014 17:56:18 +1100 Subject: Re: PyWart: "Python's import statement and the history of external dependencies" From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 73 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1416725780 news.xs4all.nl 2860 [2001:888:2000:d::a6]:44719 X-Complaints-To: abuse@xs4all.nl X-Received-Body-CRC: 870483297 X-Received-Bytes: 8269 Xref: csiph.com comp.lang.python:81340 On Sun, Nov 23, 2014 at 5:30 PM, Steven D'Aprano wrote: > Chris Angelico wrote: > >> Okay, here's my guesses. >> >> os2emxpath: In the stdlib, but more often accessed as "os.path" while >> running under OS/2 > > Correct. I'm in a special position here, as I actually have an OS/2 system, and have used Python on it. So I know about the particular obscure system that you happened to pick there. Now, if you'd said "amigapath", I wouldn't have known. > [chomp a few correct and a few wrong, here and there] > > Not bad, but as you can see, the naming convensions are all over the place. > It's easy to accidentally shadow the std lib. Agreed. There's no way to guarantee that you aren't shadowing someone else's module, except by namespacing your own - either putting your name at the beginning of every file name ("fredfoobar_calendar") or by making a package ("fredfoobar.calendar"). It would be nice, though, to be able to *detect* shadowing. Is there a way (maybe through importlib) to ask Python to enumerate every file that could be found when attempting to "import calendar"? Something like this: >>> import importlib >>> importlib.find_all_modules("calendar") ['calendar.py', '/usr/local/lib/python3.5/calendar.py'] That would be a useful feature, if it doesn't already exist. If it does, it could do with a bit more visibility - poking around on Google and interactively with help(importlib) etc didn't reveal it to me. >> That's what Rick said first, and then said that if you're going to be >> explicit, you should do the job properly and not have _any_ implicit >> paths. > > Rick should ask himself why virtually every single language, from compiled > languages like Ada, C, Pascal and Java, to interpreted languages like bash, > all use search paths instead of explicit paths. > > Hint: the answer is not that every single language designer in the world is > a moron. Maybe they are. Maybe Rick's just so amazingly brilliant that he, alone among all language designers, has figured this out. Maybe it's time for his fork of Python to sweep the world with its incredible solutions to massively prevalent problems! While it *is* possible for every language in the world to get something wrong, there's usually a few around the place that get it right. Until Python 3.3, most popular languages got Unicode support either wrong (using UTF-16 being the most common wrongness) or inefficient (using UTF-32), or just didn't have any at all (bytes everywhere). Could someone look at the state of world programming languages and say "Everyone uses UTF-16, and not every language designer in the world is a moron, therefore UTF-16 must be the right thing to do"? No, because Haskell, Scheme, Pike, and bash all had it right, already. Sure, they're not the most-used languages in the world, but they certainly are used (bash plenty, though to be honest, not many people use bash scripts for Unicode heavy-lifting), and they prove that UTF-16 isn't the only way to go. So, where are the languages that use explicit paths? Show us why they're so great, using actual production code. ChrisA