Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Problems using struct pack/unpack in files, and reading them. Date: Sun, 15 Nov 2015 04:04:18 +1100 Lines: 33 Message-ID: References: <20151113192045.GA9913@z-sverige.nu> <56469f14$0$1612$c3e8da3$5496439d@news.astraweb.com> <5646c95a$0$1597$c3e8da3$5496439d@news.astraweb.com> <87vb94ikuv.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de pM56DYG+fuuGZiA6FYy2dgK6q+movZmyH0PDPPILfSPg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.060 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; 'cc:addr:python-list': 0.09; 'subject:files': 0.09; 'subject:using': 0.09; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'operators,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:Problems': 0.16; 'unary': 0.16; 'wrote:': 0.16; 'copied': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'problem:': 0.22; 'programming': 0.22; 'am,': 0.23; 'header:In- Reply-To:1': 0.24; 'question': 0.27; 'message-id:@mail.gmail.com': 0.27; 'subject:/': 0.30; '15,': 0.30; 'useful': 0.33; 'languages': 0.34; 'received:google.com': 0.35; 'could': 0.35; 'nov': 0.35; 'something': 0.35; 'but': 0.36; 'there': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; 'why': 0.39; 'school': 0.62; 'real': 0.62; 'leaving': 0.63; 'more': 0.63; 'times': 0.63; '*really*': 0.84; 'actually,': 0.84; 'chrisa': 0.84; 'elementary': 0.84; 'subject:pack': 0.84; 'to:none': 0.91; 'write:': 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-type:content-transfer-encoding; bh=ACwobGPjAzKIueyzxTCK6cvEDp9v4r1KZG8Q9CuWc7U=; b=cn+7Kj4FgO/TZE6WNAQRbWJBcdnb7mxGVWizZ10EeWWwQg3vd/ZbpVAvOrOnSmXlxC At+ymo+oM097G3kI4h5dXUyDOBChTNqhOprMS/bGFDFZh2hsOMXFsyeb8Hk7qeemxoQw mfcT34bWP3HwREhYzkX3+tixLOE8BTc8VWl+R/PkwLZqTveMOt1SwQEzqdIc4a9H6FBI AnxXRveiJmRmxCTspSrv6nqsA8bBgm6Y4mRbmcQmvVKBj1IqTtnL61Yzpjc4CTfLfCwh PNBU/JrVYX2pAYNaa38I6bExMFiETsRSSfXqTOhM5oTQMuLK4l+7D63gpcKXGYoX0pRT 6H2w== X-Received: by 10.50.83.38 with SMTP id n6mr9479907igy.92.1447520658314; Sat, 14 Nov 2015 09:04:18 -0800 (PST) In-Reply-To: <87vb94ikuv.fsf@elektro.pacujo.net> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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:98818 On Sun, Nov 15, 2015 at 3:52 AM, Marko Rauhamaa wrote: > What I don't understand is why there is a unary + but no unary /: > > -x =E2=89=A1 0 - x > +x =E2=89=A1 0 + x > /x =E2=89=A1 1 / x > //x =E2=89=A1 1 // x > *x =E2=89=A1 1 * x > > You could write: > > r =3D //(//r1 + //r2 + //r3) > > for > > r =3D 1 // (1//r1 + 1//r2 + 1//r3) Small problem: Since we have / and // operators, it's impossible to have a unary / operator: 1 // x 1 / (/x) But leaving that aside, the number of times you'd want this are far fewer than the times you want unary minus. > Actually, the real question is, is the unary - *really* so useful that > it merits existence or is it just something that was mindlessly copied > into programming languages from elementary school arithmetics? More likely, copied from C. But that's why I made my other post. ChrisA