Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Make a unique filesystem path, without creating the file Date: Tue, 23 Feb 2016 11:18:51 +1100 Lines: 32 Message-ID: References: <85r3gf55k4.fsf@benfinney.id.au> <85mvr26dij.fsf@benfinney.id.au> <87ziusmvi0.fsf@elektro.pacujo.net> <56cb9bb5$0$1595$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de 9zoTT/CZa+qi9Kyv+I12TgnKpx+I1y7NHPnFRvrhQXAw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.015 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'received:209.85.223': 0.03; 'subject:file': 0.07; 'cc:addr:python-list': 0.09; '128': 0.09; 'expired': 0.09; '128-bit': 0.16; '2016': 0.16; '23,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'mean,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'skip:3 30': 0.16; 'unique.)': 0.16; 'utterly': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'purposes': 0.20; 'am,': 0.23; 'leave': 0.23; 'bit': 0.23; 'feb': 0.23; 'second': 0.24; 'header:In-Reply-To:1': 0.24; 'message- id:@mail.gmail.com': 0.27; 'random': 0.29; "i'm": 0.30; 'probably': 0.31; 'point': 0.33; "d'aprano": 0.33; 'impression': 0.33; 'steven': 0.33; 'tue,': 0.34; 'received:google.com': 0.35; 'something': 0.35; 'but': 0.36; 'too': 0.36; 'there': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'say': 0.37; "won't": 0.38; 'received:209': 0.38; 'sure': 0.39; 'subject:the': 0.39; 'chance': 0.60; 'ever': 0.60; 'house.': 0.63; 'due': 0.65; 'sounds': 0.76; '50%': 0.79; 'chrisa': 0.84; 'collision': 0.84; 'collision.': 0.84; 'unique.': 0.84; 'to:none': 0.91; 'heat': 0.91; 'subject:Make': 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=X5fbwoPxEnmJE1MPBjWynChnyGd1hOLGBORLlj6HPJQ=; b=KdIMsTWIAsavUlP8vKvP+caJKoEyKQSPsahO/k5H0Sn+fAfXXj/AzVQ6kY4vejg66D aTbCklpH16pPuDi2wUcJ969VYA+g7IB2c3ZqZNn88qgKtCmfqTTs6NqV+Dh03buP+GHV S90hU9E61oSE+ntjIPTg54YwyEIV6OUKEe+jpSnCAKh9WokCop6v0+1NzShS0IeqjzMS x/60ryW7RYfTkR1Au45DNLDRcDFpWWbeSmlFU2Y7KUroycD7p88SEdQGksrUufzRWohJ 5HfcNLNTZ/SiMsAjg/CU6AZB0J1UyyLQzR/DbqCs7l+FhZAyHfxipDYnLshkYK+CLXA7 k4fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc:content-type; bh=X5fbwoPxEnmJE1MPBjWynChnyGd1hOLGBORLlj6HPJQ=; b=ATq4Y74gYX5qubCMkxHlAkXZZmjf6xiwGmGeBitpY7Ns3FkYwOFZbxOzJrnPLsVAp2 R/7kJpnUJkC1xfosF/wwVvFfLteBSduo3VNqtWKMz9+FyjK6Cw0D3wI2uFdvWKW+5tdI MrmqqzU6reroL42S98OuRYS289W8jAQ+CoQ3e60DrP9bvByIY3QMkYjAg9sPRoX1wnGQ Q5QMCMQZYlqRUtZwrL1aJ4BUc3HhfqmXl9bX3JZGp9CwVsI4tHthh5doWKKG1f4Gel7K RRQ/7lUBiHx7u3zMMSB2E7teF+Ji0zn0rMza3EU4LLTQad4hpsgp+X30GMso3mxxSKY6 eQAw== X-Gm-Message-State: AG10YOSLR8cuVoxnSi2wMg3pMp454PaioLzeCdf8m4E0O4BKXA2OCV/0PKitkPzE/R3eTiVI0p3yHlUoet1bcQ== X-Received: by 10.107.132.90 with SMTP id g87mr28843790iod.157.1456186732014; Mon, 22 Feb 2016 16:18:52 -0800 (PST) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21rc2 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:103379 On Tue, Feb 23, 2016 at 11:08 AM, Jon Ribbens wrote: > On 2016-02-22, Steven D'Aprano wrote: >> On Tue, 23 Feb 2016 05:48 am, Marko Rauhamaa wrote: >>> Jon Ribbens : >>>> I was under the impression that the point of UUIDs is that you can be >>>> *so* confident that there won't be a collision that for all practical >>>> purposes it's indistinguishable from being certain. >>> >>> Yes, if you generate a random 128-bit number, it will be unique -- >> >> If you generate a second random 128 bit number, you have a chance of 1 in >> 2**128 of a collision. All you can say is that it will be *very probably* >> unique. (I might even allow "almost certainly" unique.) > > If you are not prepared to say that something with a > 340282366920938463463374607431768211455 / > 340282366920938463463374607431768211456 chance of being true > is not "certainly true" then I'm not sure how you would not > be too scared to ever leave the house. Or not leave the house. > I mean, you're probably going to be hit by 10^25 meteorites, > which sounds painful. > >> If you generate 2**128 + 1 such numbers, you are *guaranteed* to > > ... have expired due to the heat death of the universe. Maybe... but by the time you get to 2**64 of them, you have a 50% chance of a collision. (That's either utterly intuitive or completely counter-intuitive, depending on who you are.) ChrisA