Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ian Kelly Newsgroups: comp.lang.python Subject: Re: Problems using struct pack/unpack in files, and reading them. Date: Fri, 13 Nov 2015 20:48:50 -0700 Lines: 27 Message-ID: References: <20151113192045.GA9913@z-sverige.nu> <56469f14$0$1612$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de FWT2p2flmofnfk0LS2f8EA4tfJPefav8296RxIqyPY9A== 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; 'assignment': 0.07; 'augmented': 0.09; 'minus': 0.09; 'subject:files': 0.09; 'subject:using': 0.09; 'python': 0.10; '(but': 0.15; 'argument': 0.15; '"force': 0.16; 'operators.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:Problems': 0.16; 'unary': 0.16; 'wrote:': 0.16; '>': 0.18; 'email addr:gmail.com>': 0.18; 'python?': 0.18; '2015': 0.20; 'meant': 0.22; 'am,': 0.23; 'sat,': 0.23; 'header:In-Reply-To:1': 0.24; 'chris': 0.26; 'message- id:@mail.gmail.com': 0.27; '14,': 0.27; '13,': 0.29; 'btw,': 0.29; "i'm": 0.30; 'subject:/': 0.30; "d'aprano": 0.33; 'steven': 0.33; 'skip:& 20': 0.35; 'received:google.com': 0.35; 'could': 0.35; 'nov': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'to:addr :python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; 'means': 0.39; 'sure': 0.39; 'rather': 0.39; 'to:addr:python.org': 0.40; "you'll": 0.61; 'skip:n 10': 0.62; 'is.': 0.63; 'more': 0.63; 'manner': 0.69; 'hands.': 0.84; 'subject:pack': 0.84; 'to:name:python': 0.84; 'careful': 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:to :content-type; bh=bJxZJnp5r2dCPC0BDyS0kLcpQdQzTzsc2gUGxdnpUR0=; b=xT1S8dPQFBDdNAZixH1TDHZ2BXWT9rb2yr2H18TBjcx95nf9ReUmULdUMIR/Lryj82 Zmp7hsvXRsOu5sW/1zso2Q2Akyp7pF3rl5rQ+/LpzCqF2CqlbgldKUUtdERlgl4ujYF2 mOcFctMgjTnPvIWKuJ8h9wAtoP9DQ5S38g5V0E3aqMWqM/VnqKqyGeZRcMQ+etJZgWEp 1tYPlO6BmSq/WRRcNxgrHt0jaVYof7/e6myBifOXIpUHXq22xUl9eEHs3D6bCjAH3F3V tZzBGGJj2tCvuhHyAACt0lqH+dh7ctWadbS86tB2plKIRgpgcRahUXUKBCeqKPM7TTvv CmZA== X-Received: by 10.50.136.132 with SMTP id qa4mr6571513igb.68.1447472930587; Fri, 13 Nov 2015 19:48:50 -0800 (PST) In-Reply-To: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:98791 On Nov 13, 2015 8:03 PM, "Chris Angelico" wrote: > > On Sat, Nov 14, 2015 at 1:40 PM, Steven D'Aprano wrote: > > On Sat, 14 Nov 2015 09:42 am, Chris Angelico wrote: > > > >> However, this is a reasonable call for the abolition of unary plus... > > > > The only way you'll take unary plus out of Python is by prying it from my > > cold, dead hands. > > > > > > BTW, unary minus suffers from the same "problem": > > > > x =- y # oops, meant x -= y > > > > If anything, this is an argument against the augmented assignment > > short-cuts, rather than the operators. > > Yes, unary minus has the same issue - but it's a lot more important > than unary plus is. In ECMAScript, unary plus means "force this to be > a number"; what's its purpose in Python? I'm not sure "force this to be a number" is really a justification. Without it you could just use - - (but be careful not to write that as --) in the manner of using !! as "force to boolean". Or just call Number().