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


Groups > comp.lang.python > #94336

Re: Integers with leading zeroes

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 <rosuav@gmail.com>
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> <mailman.823.1437499340.3674.python-list@python.org> <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 <rosuav@gmail.com>
Cc "python-list@python.org" <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 <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>
Newsgroups comp.lang.python
Message-ID <mailman.845.1437527447.3674.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Wed, Jul 22, 2015 at 10:55 AM, Steven D'Aprano <steve@pearwood.info> 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

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


Thread

Integers with leading zeroes Steven D'Aprano <steve@pearwood.info> - 2015-07-19 15:39 +1000
  Re: Integers with leading zeroes Ian Kelly <ian.g.kelly@gmail.com> - 2015-07-18 23:46 -0600
  Re: Integers with leading zeroes "Skybuck Flying" <skybuck2000@hotmail.com> - 2015-07-19 10:19 +0200
    Re: Integers with leading zeroes Rick Johnson <rantingrickjohnson@gmail.com> - 2015-07-19 12:58 -0700
  Re: Integers with leading zeroes Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-07-21 19:21 +0200
    Re: Integers with leading zeroes sohcahtoa82@gmail.com - 2015-07-21 10:58 -0700
      Re: Integers with leading zeroes Emile van Sebille <emile@fenx.com> - 2015-07-21 11:06 -0700
        Re: Integers with leading zeroes sohcahtoa82@gmail.com - 2015-07-21 11:38 -0700
          Re: Integers with leading zeroes sohcahtoa82@gmail.com - 2015-07-21 11:41 -0700
    Re: Integers with leading zeroes Steven D'Aprano <steve@pearwood.info> - 2015-07-22 10:55 +1000
      Re: Integers with leading zeroes Chris Angelico <rosuav@gmail.com> - 2015-07-22 11:10 +1000
        Re: Integers with leading zeroes Steven D'Aprano <steve@pearwood.info> - 2015-07-22 12:14 +1000
          Re: Integers with leading zeroes Chris Angelico <rosuav@gmail.com> - 2015-07-22 14:16 +1000
          Re: Integers with leading zeroes Laura Creighton <lac@openend.se> - 2015-07-22 09:12 +0200
            Re: Integers with leading zeroes alister <alister.nospam.ware@ntlworld.com> - 2015-07-22 09:09 +0000
              Re: Integers with leading zeroes Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-07-22 17:27 +0200
                Re: Integers with leading zeroes Grant Edwards <invalid@invalid.invalid> - 2015-07-22 15:47 +0000
              Re: Integers with leading zeroes MRAB <python@mrabarnett.plus.com> - 2015-07-22 16:38 +0100
                Re: Integers with leading zeroes Grant Edwards <invalid@invalid.invalid> - 2015-07-22 15:50 +0000
                Re: Integers with leading zeroes MRAB <python@mrabarnett.plus.com> - 2015-07-22 17:24 +0100
              Re: Integers with leading zeroes Chris Angelico <rosuav@gmail.com> - 2015-07-23 08:32 +1000
          Re: Integers with leading zeroes Laura Creighton <lac@openend.se> - 2015-07-22 09:31 +0200
          Re: Integers with leading zeroes Ben Finney <ben+python@benfinney.id.au> - 2015-07-22 18:40 +1000
            Re: Integers with leading zeroes Marko Rauhamaa <marko@pacujo.net> - 2015-07-22 12:10 +0300
              Re: Integers with leading zeroes Laura Creighton <lac@openend.se> - 2015-07-22 11:38 +0200
                Re: Integers with leading zeroes Marko Rauhamaa <marko@pacujo.net> - 2015-07-22 13:26 +0300
            Re: Integers with leading zeroes Grant Edwards <invalid@invalid.invalid> - 2015-07-22 13:51 +0000
              Re: Integers with leading zeroes Rustom Mody <rustompmody@gmail.com> - 2015-07-22 07:03 -0700
              Re: Integers with leading zeroes Steven D'Aprano <steve@pearwood.info> - 2015-07-23 01:14 +1000
                Re: Integers with leading zeroes Grant Edwards <invalid@invalid.invalid> - 2015-07-22 15:20 +0000
              Re: Integers with leading zeroes Michael Torrie <torriem@gmail.com> - 2015-07-22 20:11 -0600
                Re: Integers with leading zeroes Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-07-24 18:23 +1200
                Re: Integers with leading zeroes Chris Angelico <rosuav@gmail.com> - 2015-07-24 16:28 +1000
                Re: Integers with leading zeroes alister <alister.nospam.ware@ntlworld.com> - 2015-07-24 13:16 +0000

csiph-web