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


Groups > comp.lang.python > #75936

Re: Template language for random string generation

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 2014-08-09 01:57 -0600
Subject Re: Template language for random string generation
Newsgroups comp.lang.python
Message-ID <mailman.12787.1407571088.18130.python-list@python.org> (permalink)

Show all headers | 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