Language documentation ( was Re: Computing Industry shams)

vermicule rambam at bigpond.net.au
Sat May 7 20:23:35 EDT 2005


"Xah Lee" <xah at xahlee.org> writes:

> A|B, where A and B can be arbitrary REs, creates a regular expression
> that will match either A or B. An arbitrary number of REs can be
> separated by the "|" in this way. This can be used inside groups (see
> below) as well. As the target string is scanned, REs separated by "|"
> are tried from left to right. When one pattern completely matches, that
> branch is accepted. This means that once A matches, B will not be
> tested further, even if it would produce a longer overall match. In
> other words, the "|" operator is never greedy. To match a literal "|",
> use \|, or enclose it inside a character class, as in [|].
>
> --end quote--
>
> Note: In other words, the "|" operator is never greedy.
>
> Note the need to inject the high-brow jargon "greedy"here as a
> latch on sentence.

What is so hard to understand ?
Should be perfectly clear even to a first year undergraduate.

As for "greedy" even a minimal exposure to Djikstra's shortest path
algorithm would have made the concept intuitive. And from memory,
that is the sort of thing done in Computing 101 and in  Data Structures and
Algorithms 101

It seems to me that you want the Python doc to be written for morons.
And that is not a valid complaint. 



More information about the Python-list mailing list