Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #98819

Re: Problems using struct pack/unpack in files, and reading them.

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Ian Kelly <ian.g.kelly@gmail.com>
Newsgroups comp.lang.python
Subject Re: Problems using struct pack/unpack in files, and reading them.
Date Sat, 14 Nov 2015 10:04:36 -0700
Lines 27
Message-ID <mailman.334.1447520685.16136.python-list@python.org> (permalink)
References <20151113192045.GA9913@z-sverige.nu> <CALwzidknLk3w8NWJqhYXjCFy4uBm79dxhBn=oaXCtxfJu-d-_g@mail.gmail.com> <mailman.310.1447454532.16136.python-list@python.org> <56469f14$0$1612$c3e8da3$5496439d@news.astraweb.com> <mailman.314.1447470111.16136.python-list@python.org> <5646c95a$0$1597$c3e8da3$5496439d@news.astraweb.com> <mailman.329.1447515842.16136.python-list@python.org> <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 +FR0uLBt9kttXOIC7uSrigX/JWABX9cCZLkGEWbtuqgA==
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.025
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; '-1.': 0.09; 'subject:files': 0.09; 'subject:using': 0.09; "they've": 0.09; 'received:io': 0.16; 'received:psf.io': 0.16; 'silly': 0.16; 'subject:Problems': 0.16; 'unary': 0.16; 'wrote:': 0.16; 'integer': 0.18; '&gt;': 0.18; '2015': 0.20; 'am,': 0.23; 'code,': 0.23; 'bit': 0.23; 'seems': 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; '14,': 0.27; 'division': 0.29; 'subject:/': 0.30; 'code': 0.30; 'somebody': 0.30; 'though.': 0.33; 'received:google.com': 0.35; 'could': 0.35; 'nov': 0.35; 'but': 0.36; 'there': 0.36; 'received:209.85': 0.36; 'possible': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; 'why': 0.39; 'to:addr:python.org': 0.40; 'ever': 0.60; 'real': 0.62; 'results': 0.66; 'subject:pack': 0.84; 'to:name:python': 0.84; 'write:': 0.91; 'imagine': 0.96
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:to :content-type; bh=ImeZfqF73KFC1szNccHWKdd15oHUXMPciWMc0mqPDlo=; b=mmmUDKOv7CVRvpSvTXf1Z/baUBUJpJsPle4inRJqhBzSzWRCauTxQRtkc950l7LMii 7vwBkdA1p/Ymkn8jPxXMGgm35UGZwzR9oFgvFlVpRHMvR/hyiFY599O95Bo88m8hred7 26HEHIUDHcW9em3mtesD/URPf6gbMtSMSsKULz/+hpZciWuv3FeJfEDsI3f/lzQKVNye pG7HW+QKAaTedxZT6KL8T/kPz7Aa+2EZ1R/Fsr/P/0Zttph7ehZLUHLudHpdG52r/UKD GgmJ0m7P8+UADfcDzvg4UaBorq3IhbqMicv07FBTuPQFCRII+CR1OO9HtlbaipjTeTxQ MeIQ==
X-Received by 10.50.136.132 with SMTP id qa4mr8655868igb.68.1447520676608; Sat, 14 Nov 2015 09:04:36 -0800 (PST)
In-Reply-To <87vb94ikuv.fsf@elektro.pacujo.net>
X-Content-Filtered-By Mailman/MimeDel 2.1.20+
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:98819

Show key headers only | View raw


On Nov 14, 2015 9:56 AM, "Marko Rauhamaa" <marko@pacujo.net> wrote:
>
> Ian Kelly <ian.g.kelly@gmail.com>:
>
> > For somebody reading one of these uses of unary plus in real code, I
> > imagine it would be a bit of a WTF moment if it's the first time
> > they've encountered it. I don't recall ever seeing any code that
> > actually used this, though.
>
> What I don't understand is why there is a unary + but no unary /:
>
>    -x ≡ 0 - x
>    +x ≡ 0 + x
>    /x ≡ 1 / x
>    //x ≡ 1 // x
>    *x ≡ 1 * x
>
> You could write:
>
>    r = //(//r1 + //r2 + //r3)
>
> for
>
>    r = 1 // (1//r1 + 1//r2 + 1//r3)

Unary integer division seems pretty silly since the only possible results
would be 0, 1 or -1.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Problems using struct pack/unpack in files, and reading them. Chris Angelico <rosuav@gmail.com> - 2015-11-14 09:42 +1100
  Re: Problems using struct pack/unpack in files, and reading them. Steven D'Aprano <steve@pearwood.info> - 2015-11-14 13:40 +1100
    Re: Problems using struct pack/unpack in files, and reading them. Chris Angelico <rosuav@gmail.com> - 2015-11-14 14:01 +1100
      Re: Problems using struct pack/unpack in files, and reading them. Steven D'Aprano <steve@pearwood.info> - 2015-11-14 16:40 +1100
        Re: Problems using struct pack/unpack in files, and reading them. Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-14 08:43 -0700
          Re: Problems using struct pack/unpack in files, and reading them. Marko Rauhamaa <marko@pacujo.net> - 2015-11-14 18:52 +0200
            Re: Problems using struct pack/unpack in files, and reading them. Chris Angelico <rosuav@gmail.com> - 2015-11-15 04:04 +1100
              Re: Problems using struct pack/unpack in files, and reading them. Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-11-16 19:19 +1300
            Re: Problems using struct pack/unpack in files, and reading them. Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-14 10:04 -0700
              Re: Problems using struct pack/unpack in files, and reading them. Marko Rauhamaa <marko@pacujo.net> - 2015-11-14 23:53 +0200
              Re: Problems using struct pack/unpack in files, and reading them. Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-11-16 19:15 +1300
                Re: Problems using struct pack/unpack in files, and reading them. Steven D'Aprano <steve@pearwood.info> - 2015-11-16 23:11 +1100
                Re: Problems using struct pack/unpack in files, and reading them. Dave Farrance <df@see.replyto.invalid> - 2015-11-17 09:54 +0000
            Re: Problems using struct pack/unpack in files, and reading them. Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-14 10:13 -0700
            Re: Problems using struct pack/unpack in files, and reading them. Random832 <random832@fastmail.com> - 2015-11-14 17:53 -0500
              Re: Problems using struct pack/unpack in files, and reading them. Marko Rauhamaa <marko@pacujo.net> - 2015-11-15 02:12 +0200
              Re: Problems using struct pack/unpack in files, and reading them. Steven D'Aprano <steve@pearwood.info> - 2015-11-15 12:14 +1100
                Re: Problems using struct pack/unpack in files, and reading them. Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-11-15 11:09 -0500
                Re: Problems using struct pack/unpack in files, and reading them. Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-11-16 19:11 +1300
            Re: Problems using struct pack/unpack in files, and reading them. MRAB <python@mrabarnett.plus.com> - 2015-11-15 00:49 +0000
          Re: Problems using struct pack/unpack in files, and reading them. Steven D'Aprano <steve@pearwood.info> - 2015-11-15 13:08 +1100
            Re: Problems using struct pack/unpack in files, and reading them. Chris Angelico <rosuav@gmail.com> - 2015-11-15 13:23 +1100
              Re: Problems using struct pack/unpack in files, and reading them. Steven D'Aprano <steve@pearwood.info> - 2015-11-17 00:17 +1100
                Re: Problems using struct pack/unpack in files, and reading them. Chris Angelico <rosuav@gmail.com> - 2015-11-17 00:27 +1100
        Re: Problems using struct pack/unpack in files, and reading them. Chris Angelico <rosuav@gmail.com> - 2015-11-15 03:59 +1100
    Re: Problems using struct pack/unpack in files, and reading them. Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-13 20:45 -0700
    Re: Problems using struct pack/unpack in files, and reading them. Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-13 20:48 -0700
    Re: Problems using struct pack/unpack in files, and reading them. Chris Angelico <rosuav@gmail.com> - 2015-11-14 14:56 +1100
    Re: Problems using struct pack/unpack in files, and reading them. Chris Angelico <rosuav@gmail.com> - 2015-11-14 14:57 +1100

csiph-web