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

noreply@sourceforge.net noreply@sourceforge.net
Sun, 15 Jul 2001 09:05:00 -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: Open
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.


----------------------------------------------------------------------

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