Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'literal': 0.09; 'subject:language': 0.09; 'subject:string': 0.09; 'cc:addr:python- list': 0.11; 'did,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'generator.': 0.16; 'personally,': 0.16; 'separated': 0.16; 'subject:generation': 0.16; 'subject:random': 0.16; 'trivially': 0.16; ':-)': 0.16; 'language': 0.16; 'wrote:': 0.18; 'split': 0.19; 'aug': 0.22; 'portion': 0.22; 'cc:addr:python.org': 0.22; 'text,': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'specified': 0.30; 'message-id:@mail.gmail.com': 0.30; "d'aprano": 0.31; 'steven': 0.31; 'url:python': 0.33; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'google': 0.35; 'there': 0.35; 'really': 0.36; 'templates': 0.36; 'example,': 0.37; 'so,': 0.37; 'too': 0.37; 'two': 0.37; 'somebody': 0.38; 'either': 0.39; 'even': 0.60; "you're": 0.61; 'youtube': 0.65; 'to:none': 0.92 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=NLBbXrP9Wl+h672gHUZp4gJF9rWRg3PsrR+1RxDomQU=; b=iT4CLfVNqMBACPFQVk7EYiPKtpOAVarg8qF9YuwmTgPk7SfweBiM1/Ija/+JP0LOJh BasyCesBHQOVH/2P93scpiCa0TQBMHF5jl1M69cGoBIdcbvBv4CMWPWHEEfV5gBO+6W7 7dwKb6jOf05hz5EED8t3+krhRJZlE7v2OF2yaxus89G2MhEjkt27rKBDGpzqVAGv4f2d xHCSEhM5zeyGTCj0l7en51RZ+kMirCtJKfcRlffHRWRJ6WCi9qYBkcMh2qDhD0wLdNUW ZqJ4YC1vMITVhfOzUPDF0OxfQmySR40uLXi3p9qpZ/CrZPpLmT/O4HAnjCKW4oNQulyP pVwQ== MIME-Version: 1.0 X-Received: by 10.42.216.148 with SMTP id hi20mr27020523icb.12.1407698756599; Sun, 10 Aug 2014 12:25:56 -0700 (PDT) In-Reply-To: <53e79e46$0$29967$c3e8da3$5496439d@news.astraweb.com> References: <14d94692-2257-4dfb-a82f-f1674a839233@googlegroups.com> <53e79e46$0$29967$c3e8da3$5496439d@news.astraweb.com> Date: Mon, 11 Aug 2014 05:25:56 +1000 Subject: Re: Template language for random string generation 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.15 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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1407698764 news.xs4all.nl 2957 [2001:888:2000:d::a6]:48668 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76002 On Mon, Aug 11, 2014 at 2:31 AM, Steven D'Aprano wrote: > Personally, I think even the OP's specified language is too complex. For > example, it supports literal text, but given the use-case (password > generators) do we really want to support templates like "password[\d]"? I > don't think so, and if somebody did, they can trivially say "password" + > SG('[\d]').render(). What if you're using this to generate IDs for something (think Youtube video references), and you want to have an alphabetic portion and a numeric portion separated by a hyphen? I think there is a use-case for interior literal text, because otherwise you'd have to either split the result or do two calls to the generator. > Here, let me google that for you :-) > > https://duckduckgo.com/html/?q=python+crypto Hehe. :) ChrisA