Why it does NOT work on Linux ?

Steve Holden sholden at holdenweb.com
Thu Feb 7 08:40:17 EST 2002


"Jason Orendorff" <jason at jorendorff.com> wrote in message
news:mailman.1012871110.28776.python-list at python.org...
> Steve Holden wrote:
> > Markus Schönhaber wrote:
> > > 1.) Here
> > > > IDs=re.compile('.*<a href="lead.asp\?ItemID=(\d{5,10}).*')
> > > > Results=re.findall(IDs,Text)
> > >
> > > you call re.findall with a regular expression object as a first
> > > parameter which should be a string. What you want to do is
> > >
> > > Results = IDs.findall(Text)
> > >
> > > i. e. call the appropriate method on the re object you created.
> > >
> > While your suggestion is correct, it is incorrect to say that Ladislav's
> > method is wrong.
>
> Ladislav's use of findall works, but this feature of re.findall()
> is not documented and should be avoided, as undocumented features
> have been known to disappear.
>
Nonsense. The function interface continues to be a fully-documented part of
the re module. You are apparently confusing

    http://www.python.org/doc/current/lib/node99.html

(the re module contents description, which describes the functional
interface to regular expressions) with

    http://www.python.org/doc/current/lib/re-objects.html

(the method descriptions for re objects). It may not be the way *you* do it,
but that doesn't mean it's not documented <wink>. For now, either approach
is both documented and valid, as it is for strings (string.replace(s, p, r)
versus s.replace(p, r)).

regards
 Steve
--
Consulting, training, speaking: http://www.holdenweb.com/
Author, Python Web Programming: http://pydish.holdenweb.com/pwp/

"This is Python.  We don't care much about theory, except where it
intersects with useful practice."  Aahz Maruch on c.l.py







More information about the Python-list mailing list