Performance on local constants?
Matthew Franz
mdfranz at gmail.com
Thu Dec 27 15:53:32 EST 2007
I get class Searcher(object) but can't for the life of me see why
(except to be intentionally obtuse) one would use the def
searcher(rex) pattern which I assure you would call with
searcher(r)(t) right?
- mdf
> >
> > 'Most flexible' in a different way is
> >
> > def searcher(rex):
> > crex = re.compile(rex)
> > def _(txt):
> > return crex.search(txt)
> > return _
> >
>
> I see your obfuscatory ante and raise you several dots and
> underscores:
>
> class Searcher(object):
> def __init__(self, rex):
> self.crex = re.compile(rex)
> def __call__(self, txt):
> return self.crex.search(txt)
>
More information about the Python-list
mailing list