regex - Does re.compile() or any given Python library call throw an exception? -


i can't tell python documentation whether re.compile(x) function may throw exception (assuming pass in string). imagine there considered invalid regular expression. larger question is, go find if given python library call may throw exception(s) , are?

well, re.compile may:

>>> import re >>> re.compile('he(lo') traceback (most recent call last):   file "<stdin>", line 1, in <module>   file "c:\python25\lib\re.py", line 180, in compile     return _compile(pattern, flags)   file "c:\python25\lib\re.py", line 233, in _compile     raise error, v # invalid expression sre_constants.error: unbalanced parenthesis 

the documentation support this, in roundabout way - check bottom of "module contents" page (brief) description of error exception.

unfortunately, don't have answer general question. suppose documentation various modules varies in quality , thoroughness. if there particular modules interested in, might able decompile them (if written in python) or look @ source, if they're in standard library.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -