converting from perl: variable sized unpack

Roy Smith roy at
Mon Jul 16 03:42:50 CEST 2001

quinn at (Quinn Dunkan) wrote:
> Even without that, I argue that a bad pattern match should throw an 
> exception and not assign None

I have to admit, that would be somewhat consistant with the way the rest of 
the language works, but it sure would make it more complicated to do 
something like:

   if re.match (pattern1, string):
      do stuff
   elif re.match (pattern2, string):
      do other stuff
   elif re.match (pattern3, string):
      etc, etc, etc.

More information about the Python-list mailing list