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


Groups > comp.lang.python > #32699

Re: How to generate account number?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python.list@tim.thechases.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'binary': 0.05; 'chunk': 0.07; 'subject:How': 0.09; 'subject:number': 0.09; 'cc:addr :python-list': 0.10; ':-)': 0.13; 'encoding': 0.15; 'value.': 0.15; '-tkc': 0.16; '[*]': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'lowercase': 0.16; 'message-id:@tim.thechases.com': 0.16; 'omitting': 0.16; 'received:70.251': 0.16; 'received:dsl.rcsntx.swbell.net': 0.16; 'received:rcsntx.swbell.net': 0.16; 'received:swbell.net': 0.16; 'roy': 0.16; 'wrote:': 0.17; '>>>': 0.18; '3.2': 0.22; 'back.': 0.22; 'number)': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'idea': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; '(which': 0.26; 'skip:( 20': 0.28; 'concern': 0.29; 'character': 0.29; 'print': 0.32; 'zero': 0.33; 'subject:?': 0.35; 'but': 0.36; 'characters': 0.36; 'too': 0.36; 'one,': 0.37; 'does': 0.37; 'subject:: ': 0.38; 'easier': 0.38; 'things': 0.38; 'several': 0.39; 'gives': 0.39; 'end': 0.40; 'easy': 0.60; 'back': 0.62; 'letters': 0.62; 'information': 0.63; 'making': 0.64; 'capital': 0.68; 'smith': 0.71; 'subject:account': 0.74; 'eye,': 0.84; 'received:50.22': 0.84; 'cars': 0.91; 'mistake': 0.91
Date Sat, 03 Nov 2012 10:34:26 -0500
From Tim Chase <python.list@tim.thechases.com>
User-Agent Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111120 Icedove/3.1.16
MIME-Version 1.0
To Roy Smith <roy@panix.com>
Subject Re: How to generate account number?
References <mailman.3220.1351890866.27098.python-list@python.org> <1gsdm9-r2c.ln1@crazy-horse.bildanet.com> <mailman.3234.1351931985.27098.python-list@python.org> <roy-1E6B33.09225503112012@news.panix.com>
In-Reply-To <roy-1E6B33.09225503112012@news.panix.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - boston.accountservergroup.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - tim.thechases.com
X-Source
X-Source-Args
X-Source-Dir
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3242.1351956818.27098.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1351956818 news.xs4all.nl 6879 [2001:888:2000:d::a6]:38098
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:32699

Show key headers only | View raw


On 11/03/12 08:22, Roy Smith wrote:
> Even better might be base-32 encoding the value.  Strings of
> digits have an information density of about 3.2 bits/char.
> Base-32 is just about as readable, but gives you 5 bits/char, so
> you end up with a few less characters (which you still want to
> chunk into 3 or 4 character groups).

For things that will be read off a screen/paper, I recommend
omitting several letters that are easy to mistake visually:  i/I/l/1
and O/0 in particular.  The VIN (vehicle identification number) on
all US cars avoids these characters[*], making it easier to read
them back without concern for "is that a zero or an oh; and is that
an ell, a one, a lowercase eye, or a capital eye?"  As an encoding
advantage,

>>> print len(''.join(c for c in (string.ascii_uppercase +
string.digits) if c not in "O0iIl1"))
32

the number 32 is pretty handy when dealing with binary :-)

-tkc


[*]
The VIN avoids "Q" too and does use the digits 0/1, but the idea
holds.  Make it easy to ready back.

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


Thread

How to generate account number? Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-03 00:13 +0300
  Re: How to generate account number? GangGreene <GangGreene@example.com> - 2012-11-02 18:02 -0400
    RE: How to generate account number? Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-03 11:38 +0300
      Re: How to generate account number? Roy Smith <roy@panix.com> - 2012-11-03 09:22 -0400
        Re: How to generate account number? Tim Chase <python.list@tim.thechases.com> - 2012-11-03 10:34 -0500
        RE: How to generate account number? Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-03 19:18 +0300
        RE: How to generate account number? Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-03 19:23 +0300
  Re: How to generate account number? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-02 22:39 +0000
    RE: How to generate account number? Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-03 11:42 +0300

csiph-web