Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Undefined behaviour in C [was Re: The Cost of Dynamism] Date: Sun, 27 Mar 2016 08:58:42 +1100 Lines: 42 Message-ID: References: <56e7483d$0$1608$c3e8da3$5496439d@news.astraweb.com> <56ef9787$0$1516$c3e8da3$5496439d@news.astraweb.com> <56f02196$0$1588$c3e8da3$5496439d@news.astraweb.com> <56f42d9f$0$1618$c3e8da3$5496439d@news.astraweb.com> <56f55e2e$0$1619$c3e8da3$5496439d@news.astraweb.com> <56f666d8$0$1583$c3e8da3$5496439d@news.astraweb.com> <2e1ce88d-fae2-4aa0-ace9-4faa4878459b@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de 8fjlgPNebjxrqf+/BK0rMAEEFICzohKP1TrrMuaLL9zQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'cpython': 0.05; 'cc:addr :python-list': 0.09; 'errno': 0.09; 'ioerror': 0.09; 'python': 0.10; 'exception': 0.13; 'interpreter': 0.15; '2016': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'module:': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subclassing': 0.16; 'url:linux': 0.16; 'wrote:': 0.16; "wouldn't": 0.16; 'integer': 0.18; 'typical': 0.18; 'language': 0.19; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'am,': 0.23; 'errors': 0.23; "python's": 0.23; 'sat,': 0.23; 'header:In-Reply- To:1': 0.24; 'linux': 0.26; 'figure': 0.27; 'error': 0.27; 'message-id:@mail.gmail.com': 0.27; 'errors.': 0.27; 'device': 0.28; 'relies': 0.29; 'subject: [': 0.29; 'code': 0.30; 'programmers': 0.30; 'point': 0.33; 'url:python': 0.33; 'accessible': 0.33; "d'aprano": 0.33; 'lets': 0.33; 'steven': 0.33; 'similar': 0.33; 'file': 0.34; 'received:google.com': 0.35; 'could': 0.35; "isn't": 0.35; 'but': 0.36; 'instead': 0.36; 'there': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'url:library': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; 'means': 0.39; 'build': 0.40; 'space': 0.40; 'called': 0.40; 'url:3': 0.60; 'subject:The': 0.61; 'is.': 0.63; 'saturday,': 0.63; 'march': 0.64; 'mar': 0.65; 'here': 0.66; 'natural': 0.67; '26,': 0.72; 'chrisa': 0.84; 'utc+5:30,': 0.84; 'to:none': 0.91 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-transfer-encoding; bh=JwKFzbJQ2wCQIsQt70hWvI1J1x4NwuH0dYlm1GhV14M=; b=avtq0mpOyZMRZkSJbMuP5cmZ0++YesjH2Dn/S7ajMMjUEYHN8/YJ3VyJRrtRL0l6aD uck6vvOmYiYYidJVgJMmWJOtJ5qVnSvmz4NGxrmJoRIfr2KpYOU1ROpgml976Jg3CswX 2OvpuuIDjPL4FhDuen8Zn9SMyFyiefK1GhWd43Bf8GbN2xLD3PGGb+7kdXfANWsQXNM3 NpsoT/QPCRblQIqQlf/Mr559iPFtczVUpnisneN6nuDEo0KyIIS3CZKPMmYG+aNRgYC0 GbrGxYNQtvzA6ao5sqkOcKlpS+SSLtwqWlmi4bJj/varT04hLf2obsiYruf283VRbtqf TIjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc:content-transfer-encoding; bh=JwKFzbJQ2wCQIsQt70hWvI1J1x4NwuH0dYlm1GhV14M=; b=cajU69gNyU9L3wy3BvscI167WK1MOwhZzXkkfcLgXyRTSor3VxyxVrjV5zEuXc4FdY DFR3iRB/ikjANaVPA7ilczjyeAtSaK0liPNA88i1oHe0P7vOkTXQLaXHBEKmaw0yZvwu 4aJJNaqO20bDEl18+hbG6VylgmvcGisIgCjiCOBu040iFk/EYBaV+ShPwyAqFeAThCp9 Cgu2a7AhKo+3JCl5DFAnIWwqsbiZ7TbG8y2B3jTNxkx2BphjIfmCqgxWfFb2Rz0WH2hz YUc/3i8W0mdBLAcNWpTgM9PSWBYja9lhrXRlAHXrn0qidZkXQ8jHaxIpmdYQ3AMFyh2W nCIA== X-Gm-Message-State: AD7BkJKQ0+TlSx5XG8/H3d3TxTvdD/cMzsiYsVR3TRToMfmvpl8QZWeyj4NxC5iGx2GioPalMDf3YAuJx4zgZg== X-Received: by 10.50.43.226 with SMTP id z2mr3160056igl.94.1459029522547; Sat, 26 Mar 2016 14:58:42 -0700 (PDT) In-Reply-To: <2e1ce88d-fae2-4aa0-ace9-4faa4878459b@googlegroups.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:105784 On Sun, Mar 27, 2016 at 4:43 AM, Rustom Mody wrote: > On Saturday, March 26, 2016 at 4:09:41 PM UTC+5:30, Steven D'Aprano wrote= : >> On Sat, 26 Mar 2016 04:30 pm, Rustom Mody wrote: >> >> > For one thing its good to remember that we wouldn't be here without py= thon >> > Python wouldn't be what it is without CPython >> >> There is nothing about Python that relies on the C standard being as it = is. > > Um lets see... > There is this nice piece of OO called the exception hierarchy: > https://docs.python.org/2/library/exceptions.html#exception-hierarchy > > So we have > BaseException =E2=8A=87 Exception =E2=8A=87 EnvironmentError =E2=8A=87 IO= Error > At this point it would have been completely natural for IOError to contin= ue > subclassing to all the typical errors > - File not found > - No Space left on device > etc etc > > But instead we have an integer errno and we must inquire what that is to > figure out what the exact IOError was > Are you suggesting that python's errno module: > https://docs.python.org/2/library/errno.html > And C's http://man7.org/linux/man-pages/man3/errno.3.html > are coincidentally related? You're reading documentation that's aimed at C programmers for the same reason as above - aiming at C makes it accessible to the most people. But errno is not inherently bound to C; if I were to build a language interpreter in Fortran, I could make errno available to it. What you're looking at isn't so much a C thing as a Linux thing; Python makes available the Linux error code as a means of disambiguating similar errors. ChrisA