Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Random832 Newsgroups: comp.lang.python Subject: Re: Curious Omission In New-Style Formats Date: Mon, 11 Jul 2016 16:34:08 -0400 Lines: 10 Message-ID: References: <834b1cce-38dd-474c-8915-4ff1cd6b27ec@googlegroups.com> <7fcc8c21-106f-41d4-a5ba-409f3b54a56d@googlegroups.com> <5783c91e$0$1622$c3e8da3$5496439d@news.astraweb.com> <5783D63F.5040307@stoneleaf.us> <1468269248.274024.663251393.519A1DA6@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de LMEXDFbPIhcYdLSSeLrWyAlfbj397Fyw6i0l4GPWl+kw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'width': 0.07; 'objects.': 0.09; 'received:internal': 0.09; 'python': 0.10; 'hex': 0.16; 'message-id:@webmail.messagingengine.com': 0.16; 'parameter,': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'constant': 0.22; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; "i've": 0.25; 'raw': 0.27; "i'm": 0.30; 'michael': 0.33; 'usually': 0.33; 'int': 0.33; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'desired': 0.37; 'received:66': 0.38; 'sure': 0.39; 'subject:-': 0.39; 'to:addr:python.org': 0.40; 'ever': 0.60; 'header:Message-Id:1': 0.61; 'wanting': 0.66; 'jul': 0.72 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=D9Gi9crDuZg57RBd4+AyTybvK5o=; b=oHoYmf Aq6BwyukQjZ4/7pbvDVXzlfjso3D4cwYvqLvUADcXiDvPzZ8azJymBQcNQ/UYZP4 Ity21sm0DdMVFq49Zvani0AP4kf2oevVzMI3OY91zxkUZRkdFW/mn7nEsb7o1msw 2IM/nRo5mK6N0z7Xdir4VHAgTTtL1fAdUInMQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=D9Gi9crDuZg57RB d4+AyTybvK5o=; b=d5Myzl+7hkrJnIwodcT9y2s3FOH+vX4vkqCdQeAY6KEacDw IFPen0qHTFojc5ESXGr35yqFmFjkN4N2Mm3Yo2G1x/P+MEt6qV2iVBfVT/f8MhdK p0D8/G1Fw/LamwfFcD5VgiD8goco23qEg+BKpwpjs5lzIkv2CxbLGWSqEaQM= X-Sasl-Enc: /oQwVKqLxTRLqMYotr8Kel01/fRaUB6/TLTIq/GNezT+ 1468269248 X-Mailer: MessagingEngine.com Webmail Interface - ajax-f28fce62 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <1468269248.274024.663251393.519A1DA6@webmail.messagingengine.com> X-Mailman-Original-References: <834b1cce-38dd-474c-8915-4ff1cd6b27ec@googlegroups.com> <7fcc8c21-106f-41d4-a5ba-409f3b54a56d@googlegroups.com> <5783c91e$0$1622$c3e8da3$5496439d@news.astraweb.com> <5783D63F.5040307@stoneleaf.us> Xref: csiph.com comp.lang.python:111291 On Mon, Jul 11, 2016, at 16:06, Michael Torrie wrote: > I'm not sure I've ever seen a negative hex number in the wild. Usually > when I view a number in hex I am wanting the raw representation. -0x123 > with a width of 7 would be 0xFFEDD There's nothing "raw" about python int objects. To get what you want, you need to do x & 0xfffff If you have "5" as a parameter, you can get the desired constant as (1 << x*4) - 1.