2012-08-28, 09:44
Alright, I have a question!
What is the benefit of plugins using re.compile when they don't even save the regular expression object to reuse later on anyways?
As an example, I've seen repeatedly in plugins:
This can be made easier to read (in my mind) and doesn't require the creation of an unnecessary and unused regular expression object:
So why re.compile vs re.findall?
Sorry, I was just going thru some source code and kept coming up to this.
What is the benefit of plugins using re.compile when they don't even save the regular expression object to reuse later on anyways?
As an example, I've seen repeatedly in plugins:
Code:
match = re.compile('whatever').findall(html)[0]
This can be made easier to read (in my mind) and doesn't require the creation of an unnecessary and unused regular expression object:
Code:
match = re.findall('whatever', html)[0]
So why re.compile vs re.findall?
Sorry, I was just going thru some source code and kept coming up to this.