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


Groups > comp.lang.python > #75936

Re: Template language for random string generation

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!81.171.88.16.MISMATCH!hq-usenetpeers.eweka.nl!hq-usenetpeers.eweka.nl!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'syntax': 0.04; 'expressions': 0.07; 'matches': 0.07; 'string': 0.09; 'friday,': 0.09; 'subject:language': 0.09; 'subject:string': 0.09; 'template': 0.14; 'expressions.': 0.16; 'for,': 0.16; 'lowercase': 0.16; 'mode,': 0.16; 'nightmare.': 0.16; 'subject:generation': 0.16; 'subject:random': 0.16; 'template,': 0.16; 'terribly': 0.16; 'uppercase': 0.16; 'sat,': 0.16; 'language': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'aug': 0.22; "aren't": 0.24; 'module,': 0.24; 'fairly': 0.24; 'paul': 0.24; 'equivalent': 0.26; 'pass': 0.26; 'least': 0.26; 'certain': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'matching': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'work.': 0.31; 'contrast,': 0.31; 'equivalent.': 0.31; 'though.': 0.31; 'regular': 0.32; 'could': 0.34; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'too': 0.37; 'e.g.': 0.38; 'to:addr:python-list': 0.38; 'expect': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'expression': 0.60; 'ian': 0.60; 'august': 0.61; 'more': 0.64; 'series': 0.66; 'further,': 0.74; 'case?': 0.84; 'regular,': 0.84; 'difficult,': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=zMFyZpJMhwcwDmpNBJAvjEh83JDzteYh9+HWpSIGNW0=; b=qsh8WWQyoV+622YsgjIOUcHwXaqpuZRsXZOvvfgvNLlilrEwz/z1kYKTy57YRCBEWg dcxyY6fgTYvXEfuOa6L6zmA/HBr+gtBu0BiBM3i2XRlMcQ12XEUdsbfhaAA/ySulk82o IutQ3TAV667GDK6H4WBp2/ym2iFbCpihHZHwbBH6mDdapRNE0JTuU1Yt9PSNxzV06yw3 NS+zdGizUwXQLy0UZDyXysISKvaj6Nh2ZxtkkmEhHBl6BiSLQsUqTc3YSY9HhnS1rWj2 E00H1bI8MkrncR9lsuN5zkSLg8By6v1sQvdzhr4jhaN4YmUwJOJaafxVTlB0NOGUxzbI Cosg==
X-Received by 10.70.88.105 with SMTP id bf9mr29370062pdb.54.1407571078955; Sat, 09 Aug 2014 00:57:58 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <CALwzidm66C7egm8DueonKnXD+o+EyEMbuRxVSkXnxMNgjyUp2g@mail.gmail.com>
References <14d94692-2257-4dfb-a82f-f1674a839233@googlegroups.com> <mailman.12765.1407535446.18130.python-list@python.org> <58187503-1651-4eca-a131-49f474148f62@googlegroups.com> <CALwzidm66C7egm8DueonKnXD+o+EyEMbuRxVSkXnxMNgjyUp2g@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Sat, 9 Aug 2014 01:57:18 -0600
Subject Re: Template language for random string generation
To Python <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 <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.12787.1407571088.18130.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1407571088 news.xs4all.nl 2869 [2001:888:2000:d::a6]:48801
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 5104
X-Received-Body-CRC 2409833380
Xref csiph.com comp.lang.python:75936

Show key headers only | View raw


On Sat, Aug 9, 2014 at 1:49 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
> On Sat, Aug 9, 2014 at 12:52 AM, Paul Wolf <paulwolf333@gmail.com> wrote:
>> On Friday, 8 August 2014 23:03:18 UTC+1, Ian  wrote:
>>> Have you given any thought to adding a validation mode, where the user
>>> provides a template and a string and wants to know if the string
>>> matches the template?
>>
>> Isn't that what regular expressions are? Or do you have a clarifying use case?
>>
>> strgen is provided as the converse of regular expressions.
>
> The syntax is not equivalent though. You can't take a strgen template,
> pass it into the re module, and just expect it to work.
>
> Also, I'm not sure how best to go about writing a regular expression
> for, e.g. "12 or more letters, digits, and punctuation, including at
> least one each of uppercase letter, lowercase letter, digit, and
> punctuation". I'm fairly certain that language is regular, but
> actually matching it with a regular expression would be a nightmare.

To clarify further, validating that *without* using a regular
expression is not too terribly difficult, but the value that I see in
validating it with a strgen is that one could then be sure that one's
string generation and validation were equivalent. In contrast, if you
have a strgen for generation and a series of string manipulations for
validation, then it's hard to be certain there aren't any differences.

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


Thread

Template language for random string generation Paul Wolf <paulwolf333@gmail.com> - 2014-08-08 02:01 -0700
  Re: Template language for random string generation Chris Angelico <rosuav@gmail.com> - 2014-08-08 19:22 +1000
    Re: Template language for random string generation Paul Wolf <paulwolf333@gmail.com> - 2014-08-08 02:42 -0700
      Re: Template language for random string generation Ned Batchelder <ned@nedbatchelder.com> - 2014-08-08 07:20 -0400
        Re: Template language for random string generation Paul Wolf <paulwolf333@gmail.com> - 2014-08-08 06:02 -0700
      Re: Template language for random string generation Chris Angelico <rosuav@gmail.com> - 2014-08-08 21:29 +1000
        Re: Template language for random string generation Paul Wolf <paulwolf333@gmail.com> - 2014-08-08 06:03 -0700
  Re: Template language for random string generation Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-09 00:08 +1000
  Re: Template language for random string generation Skip Montanaro <skip@pobox.com> - 2014-08-08 09:35 -0500
    Re: Template language for random string generation cwolf.algo@gmail.com - 2014-08-08 11:43 -0700
      Re: Template language for random string generation Nick Cash <nick.cash@npcinternational.com> - 2014-08-08 20:28 +0000
  Re: Template language for random string generation Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-08 16:03 -0600
    Re: Template language for random string generation Paul Wolf <paulwolf333@gmail.com> - 2014-08-08 23:52 -0700
      Re: Template language for random string generation Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-09 01:49 -0600
      Re: Template language for random string generation Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-09 01:57 -0600
  Re: Template language for random string generation Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-08-10 05:43 -0700
    Re: Template language for random string generation Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-11 02:31 +1000
      Re: Template language for random string generation Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-08-10 11:28 -0700
        Re: Template language for random string generation Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-11 12:22 +1000
          Re: Template language for random string generation Chris Angelico <rosuav@gmail.com> - 2014-08-11 12:31 +1000
          Re: Template language for random string generation Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-08-11 00:01 -0700
      Re: Template language for random string generation Chris Angelico <rosuav@gmail.com> - 2014-08-11 05:25 +1000
      Re: Template language for random string generation Paul Wolf <paulwolf333@gmail.com> - 2014-08-10 22:06 -0700
        Re: Template language for random string generation Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-11 08:58 +0100
    Re: Template language for random string generation Paul Wolf <paulwolf333@gmail.com> - 2014-08-10 09:34 -0700
      Re: Template language for random string generation Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-10 10:47 -0600
        Re: Template language for random string generation Paul Wolf <paulwolf333@gmail.com> - 2014-08-10 21:56 -0700
      Re: Template language for random string generation Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-08-10 11:48 -0700
  Re: Template language for random string generation Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-10 10:38 -0600

csiph-web