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: Sat, 14 Nov 2015 14:57:43 +1100 Lines: 14 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 AqRjCHlYfPmXHDak/LsyxASkwjE+gYTCnrcMAuRo/b5A== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'received:209.85.223': 0.03; 'cc:addr:python-list': 0.09; 'minus': 0.09; 'subject:files': 0.09; 'subject:using': 0.09; '(but': 0.15; '"force': 0.16; 'cc:name:python': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:Problems': 0.16; 'unary': 0.16; 'wrote:': 0.16; 'python?': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'sat,': 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; '14,': 0.27; "i'm": 0.30; 'subject:/': 0.30; 'received:google.com': 0.35; 'could': 0.35; 'nov': 0.35; 'something': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'received:209': 0.38; 'mean': 0.38; 'means': 0.39; 'sure': 0.39; 'is.': 0.63; 'more': 0.63; 'manner': 0.69; 'saw': 0.77; 'chrisa': 0.84; 'subject:pack': 0.84; 'to:none': 0.91; '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:cc :content-type; bh=bwGLJdX2ajRlo5PQJskDmSiXtUDIk8L7Dkp7go1dAEY=; b=PcCARe2P7+1oTKh8EpdGi+m7o8nxHazlLgSKgh3/kK/6sFM/Q/O6PWC/JxweSglN3M pH8KH8kWq47/ZpHXfQ+X/3KyYsDhbLc/yNYEPzR4GhTHED93izlfZ8qQvletK5WKjZxd alNKPmChPNmUmE7VLNj4WGeccnUhaRpP3rS/otaFu7+A8FoHbDMueWJSJatQy+EThhSV 4pG8M4K4MWNNt6EXOl/Q7x94QfTclJ5BK6mEoSC+rgj/KmPo9/WMRpuHl5oKT4gZCA3y ZGZ+vk69Yg8+/JDLWu9FSmCNDE8eWZL7rt51//wo0H8BeQ8NTkst3Y9gaRqBmDp/74bv NR0g== X-Received: by 10.107.10.233 with SMTP id 102mr23540094iok.31.1447473463527; Fri, 13 Nov 2015 19:57:43 -0800 (PST) In-Reply-To: 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:98793 On Sat, Nov 14, 2015 at 2:48 PM, Ian Kelly wrote: >> 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(). I don't use it myself, but I saw something about asm.js that demonstrated the use of "x = +x;" to mean "x is a number", and "x = x|0;" to mean "x is an integer". ChrisA