Regular Expression for Prime Numbers (or How I came to fail at them, and love the bomb)

mensanator at aol.com mensanator at aol.com
Wed Feb 13 14:11:13 EST 2008


On Feb 13, 12:53 pm, Carsten Haese <cars... at uniqsys.com> wrote:
> On Wed, 2008-02-13 at 10:40 -0800, mensana... at aol.com wrote:
> > But why doesn't it work when you make that change?
>
> I can't answer that question, because it *does* work when you make that
> change.

Well, the OP said the function was returning None which meant
no match which implies None means composite for the given example 2.

If None was supposed to mean prime, then why would returing None
for 2 be a  problem?

But isn't this kind of silly?

##    3 None
##    4 <_sre.SRE_Match object at 0x011761A0>
##    5 None
##    6 <_sre.SRE_Match object at 0x011761A0>
##    7 None
##    8 <_sre.SRE_Match object at 0x011761A0>
##    9 <_sre.SRE_Match object at 0x011761A0>
##    10 <_sre.SRE_Match object at 0x011761A0>
##    11 None
##    12 <_sre.SRE_Match object at 0x011761A0>
##    13 None
##    14 <_sre.SRE_Match object at 0x011761A0>
##    15 <_sre.SRE_Match object at 0x011761A0>
##    16 <_sre.SRE_Match object at 0x011761A0>
##    17 None
##    18 <_sre.SRE_Match object at 0x011761A0>
##    19 None



>
> --
> Carsten Haesehttp://informixdb.sourceforge.net




More information about the Python-list mailing list