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


Groups > comp.lang.python > #26135

Re: Generating valid identifiers

Path csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <gandalf@shopzeus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.119
X-Spam-Level *
X-Spam-Evidence '*H*': 0.76; '*S*': 0.00; 'django': 0.10; ':-)': 0.13; '4-digit': 0.16; '65536': 0.16; 'definition.': 0.16; 'hex': 0.16; 'hits': 0.16; 'precise': 0.22; 'tables': 0.23; 'least': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; "doesn't": 0.28; 'hash': 0.29; 'probability': 0.29; 'resolution': 0.30; 'problem.': 0.32; 'oracle': 0.33; 'turns': 0.33; 'to:addr :python-list': 0.33; "can't": 0.34; 'there': 0.35; 'characters': 0.36; 'should': 0.36; 'thank': 0.36; 'possible': 0.37; 'bad': 0.37; 'uses': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'your': 0.60; 'first': 0.61; 'side': 0.61; 'chance': 0.61; 'ever': 0.63; 'received:204': 0.72; '50%': 0.81; 'collision': 0.84; 'birthday': 0.91
Date Fri, 27 Jul 2012 09:28:56 +0200
From Laszlo Nagy <gandalf@shopzeus.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Generating valid identifiers
References <mailman.2604.1343305588.4697.python-list@python.org> <50116281$0$29978$c3e8da3$5496439d@news.astraweb.com> <CALwzidnR-H=VCWAiC-qL95C_8C_A=+LMWvCAq4+0ZCM2-UHbVw@mail.gmail.com> <CALwzidmFmXGRQbSNjC4V6maCoTzvW8aP4-zfMWiu1aV_ihocjQ@mail.gmail.com>
In-Reply-To <CALwzidmFmXGRQbSNjC4V6maCoTzvW8aP4-zfMWiu1aV_ihocjQ@mail.gmail.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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.2649.1343374141.4697.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1343374141 news.xs4all.nl 6942 [2001:888:2000:d::a6]:47258
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:26135

Show key headers only | View raw


> As a side note, the odds of having at least one hash collision among
> multiple tables are known as the birthday problem.  At 4 hex digits
> there are 65536 possible digests, and it turns out that at 302 tables
> there is a >50% chance that at least one pair of those names have the
> same 4-digit digest.  That doesn't mean you should be concerned if you
> have 302 tables in your Django Oracle database, though, because those
> colliding tables also have to match completely in the first 26
> characters of their generated names, which is not that common.  If a
> collision ever did occur, the resolution would be simple: manually set
> the name of one of the offending tables in the model definition.
>
> With 16 ** 10 possible digests, the probability of collision hits 50%
> at 1234605 tables.
Thank you for the precise explanation. :-) Well, if Django and Oracle 
uses this, then it can't be a very bad idea. :-)

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


Thread

Generating valid identifiers Laszlo Nagy <gandalf@shopzeus.com> - 2012-07-26 14:26 +0200
  Re: Generating valid identifiers Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-26 15:30 +0000
    Re: Generating valid identifiers Laszlo Nagy <gandalf@shopzeus.com> - 2012-07-26 20:08 +0200
    Re: Generating valid identifiers Ian Kelly <ian.g.kelly@gmail.com> - 2012-07-26 13:28 -0600
      Re: Generating valid identifiers Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-27 01:54 +0000
        Re: Generating valid identifiers Laszlo Nagy <gandalf@shopzeus.com> - 2012-07-27 09:34 +0200
    Re: Generating valid identifiers Ian Kelly <ian.g.kelly@gmail.com> - 2012-07-26 14:00 -0600
    Re: Generating valid identifiers Laszlo Nagy <gandalf@shopzeus.com> - 2012-07-27 09:28 +0200
    Re: Generating valid identifiers Laszlo Nagy <gandalf@shopzeus.com> - 2012-07-27 11:59 +0200

csiph-web