Python not that wierd

Steve Lamb grey at despair.rpglink.com
Wed Aug 2 01:35:10 EDT 2000


On Wed, 02 Aug 2000 02:26:55 GMT, Cliff Crawford <cjc26 at nospam.cornell.edu>
wrote:
>| I.e., I suspect a more efficacious R.E. for your match might be:
>|     if not self.compiled_re:
>|         self.compiled_re = re.compile(r'(\d*)[dD](\d*)([-+]\d+)?$')
>|     diematch = re.match(self.compiled_re,self.diecode)

>Oops, that should be

>      diematch = self.compiled_re.match(self.diecode)

>re.match only takes strings for its pattern argument, not compiled
>regexps.

    Yup, got caught by that in the main loop where I decided to compile all
the regexs once up front and then go through the main loop.  I cheated on the
regex in the class, calling it self.re so it would just be self.re.match().
:)

-- 
         Steve C. Lamb         | I'm your priest, I'm your shrink, I'm your
         ICQ: 5107343          | main connection to the switchboard of souls.
-------------------------------+---------------------------------------------



More information about the Python-list mailing list