Can I rely on...

MRAB google at mrabarnett.plus.com
Thu Mar 19 17:07:18 CET 2009


Emanuele D'Arrigo wrote:
[snip]
> If the answer is no, am I right to state the in the case portrayed
> above the only way to be safe is to use the following code instead?
> 
> for item in compiledPatterns:
>    if(item.pattern == pattern):
>         print("The compiled pattern is stored.")
>         break
> 
Correction to my last post: this isn't the same as using 'in'.

It should work, but remember that it compares only the pattern and not
any flags you might have used in the original re.compile().




More information about the Python-list mailing list