Path: csiph.com!usenet.pasdenom.info!goblin3!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.069 X-Spam-Evidence: '*H*': 0.86; '*S*': 0.00; 'cc:addr:python-list': 0.09; '22,': 0.09; 'exist.': 0.09; 'python': 0.10; 'wed,': 0.15; 'digits.': 0.16; 'examples:': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'silly': 0.16; 'wrote:': 0.16; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'am,': 0.23; 'unix': 0.24; 'header:In-Reply-To:1': 0.24; "doesn't": 0.26; 'example': 0.26; 'sense': 0.26; 'message-id:@mail.gmail.com': 0.27; 'this.': 0.28; 'decimal': 0.29; "i'm": 0.30; 'push': 0.30; 'date:': 0.31; 'fixed': 0.31; "can't": 0.32; "d'aprano": 0.33; 'steven': 0.33; 'received:google.com': 0.35; "isn't": 0.35; 'sometimes': 0.35; 'but': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'mac': 0.37; 'itself': 0.38; 'mean': 0.38; 'represent': 0.38; 'sure': 0.39; 'subject:with': 0.40; 'address:': 0.60; 'your': 0.60; 'leading': 0.61; 'address': 0.61; 'here.': 0.62; 'real- world': 0.66; 'apart': 0.70; 'eight': 0.72; 'jul': 0.72; 'chrisa': 0.84; 'common,': 0.84; 'subject:leading': 0.84; 'territory': 0.84; 'to:none': 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=QXxH4x4OA+rnxgRfgRtWC2L1BYPZ9lEWKBlX1P/GuuQ=; b=GDFo+OtBtBbtevPTs/3QXyfX3DjeYST1DI2en4qv8QvGBxlqHM2LO4lNLBmZIyJfmQ 7qFVVm7K+akwJB7ryPsIdz9kSCI3HvLc1hAMjvxnrODydgMfzeQ9YQFv4DkdumlGNKf7 A6BXErOzGEuykfn4lukG/uNVpLRw+c6bojC9oL+2yES4x6Mb8piCu0iJY5YnjQw4docK jPRtNJkAvTeprs7+jbCqIOS7cFnyIx+4JGq69ywTjTNPY6dFAHfmWDfTGE3fQpHRpzwE qdleScIRGhisMI31gVIcGsmAkFLTqJKuoboMlchSf9+ziLB1MH9TuYWn5NnIvNEZJutm Tr+g== MIME-Version: 1.0 X-Received: by 10.107.4.1 with SMTP id 1mr47391774ioe.10.1437527445578; Tue, 21 Jul 2015 18:10:45 -0700 (PDT) In-Reply-To: <55aeea13$0$1669$c3e8da3$5496439d@news.astraweb.com> References: <55ab37fb$0$1661$c3e8da3$5496439d@news.astraweb.com> <55aeea13$0$1669$c3e8da3$5496439d@news.astraweb.com> Date: Wed, 22 Jul 2015 11:10:45 +1000 Subject: Re: Integers with leading zeroes From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: , Newsgroups: comp.lang.python Message-ID: Lines: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1437527447 news.xs4all.nl 2911 [2001:888:2000:d::a6]:41678 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:94336 On Wed, Jul 22, 2015 at 10:55 AM, Steven D'Aprano wrote: >> Sometimes these numbers represent codeblocks of a fixed >> number of digits. Always writing those numbers with this >> number of digits helps being aware of this. It is also >> easier for when you need to know how many leading zero's >> such a number has. > > I'm not sure what you mean here. Python ints don't have a fixed number of > digits. Sometimes your numbers carry specific payloads or structures. A few examples: Date: 20150722 [decimal] Unix permissions: 10777 [octal] MAC address: 0014a466fba9 [hex] In the MAC address example, it doesn't make sense to elide the leading zeroes. I can't currently think of a common, real-world example that uses decimal and isn't gong to push itself to the full eight digits, apart from Northern Territory postcodes with their silly 08nn pattern, but I'm sure they exist. ChrisA