[Python-bugs-list] [ python-Bugs-441409 ] re.compile of non-string misleading (original) (raw)

noreply@sourceforge.net noreply@sourceforge.net
Thu, 18 Oct 2001 12:08:25 -0700


Bugs item #441409, was opened at 2001-07-15 00:30 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=105470&aid=441409&group_id=5470

Category: Regular Expressions Group: None

Status: Closed Resolution: None Priority: 5 Submitted By: Ben Escoto (bescoto) Assigned to: Fredrik Lundh (effbot) Summary: re.compile of non-string misleading

Initial Comment: re.compile(foo) returns foo, instead of raising an error or returning a regular expression object, if foo isn't a string. For instance:

import re re.compile(5) 5 Instead, it seems an exception should be raised. This is especially confusing when foo is a UserString or another class that subclasses it.


Comment By: Fredrik Lundh (effbot) Date: 2001-10-18 12:08

Message: Logged In: YES user_id=38376

you're supposed to be allowed to pass compiled patterns as the pattern. in 2.2b1 and later, the test has been changed to look for patterns instead of non-strings.

thanks /F


You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=105470&aid=441409&group_id=5470