Computing Industry shams

X

Xah Lee

Let me expose one another fucking incompetent part of Python doc, in
illustration of the Info Tech industry's masturbation and ignorant
nature.

The official Python doc on regex syntax (
http://python.org/doc/2.4/lib/re-syntax.html ) says:

--begin quote--

"|"
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.

“never greedy� What is greedy anyway?

“Greedyâ€, when used in the context of computing, describes a
certain characteristics of algorithms. When a algorithm for a
minimizing/maximizing problem is such that, whenever it faced a choice
it simply chose the shortest path, without considering whether that
choice actually results in a optimal solution.

The rub is that such stratedgy will often not obtain optimal result in
most problems. If you go from New York to San Francisco and always
choose the road most directly facing your destination, you'll never get
on.

For a algorithm to be greedy, it is implied that it faces choices. In
the case of alternatives in regex "regex1|regex2|regex3", there is
really no selection involved, but following a given sequence.

What the writer were thinking when he latched on about greediness, is
that the result may not be from the pattern that matches the most
substring, therefore it is not “greedyâ€. It's not greedy Python
docer's ass.

Such blind jargon throwing, as found everywhere in tech docs, is a
significant reason why the computing industry is filled with shams the
likes of unix, Perl, Programing Patterns, eXtreme Programing,
“Universal Modeling Languageâ€, fucking shits.

----
A better writen doc for the complete regex module is at:
http://xahlee.org/perl-python/python_re-write/lib/module-re.html

See also: Responsible Software Licensing
http://xahlee.org/UnixResource_dir/writ/responsible_license.html

Xah
(e-mail address removed)
∑ http://xahlee.org/
 
V

vermicule

Xah Lee said:
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.
 
S

Stan Milam

Xah said:
Let me expose one another fucking incompetent part of Python doc, in
illustration of the Info Tech industry's masturbation and ignorant
nature.

Dude, see a doctor, get some medication, and calm down!

Stan
 
?

=?iso-8859-1?q?M=E5ns_Rullg=E5rd?=

vermicule said:
[...]


It seems to me that you want the Python doc to be written for morons.

Not for morons, but for trolls. Don't feed them.
 
K

Keith Thompson

[snip]

There's probably no point in asking Xah Lee not to cross-post his
rants, but if you feel the need to post a followup, *please* post only
to appropriate newsgroups. I read this in comp.lang.c, where neither
the original post nor any of the followups are even vaguely topical.

If you must post a followup, limit it to newsgroups where it's
appropriate. If there are none, just don't post.

I've directed followups on this article to /dev/null.
 
A

alex goldman

vermicule said:
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.

He's right actually. If we understand the term "greedy" as it's used in
graph search and optimization algorithms, Python's RE matching actually IS
greedy.
 
S

Sean Burke

alex goldman said:
He's right actually. If we understand the term "greedy" as it's used in
graph search and optimization algorithms, Python's RE matching actually IS
greedy.

No, you're just confused about the optimization metric.
In regexes, "greedy" match optimizes for the longest match,
not the fastest.

And this is common regex terminology - man perlre and you will
find discussion of "greedy" vs. "stingy" matching.

-SEan
 
A

alex goldman

Sean said:
No, you're just confused about the optimization metric.
In regexes, "greedy" match optimizes for the longest match,
not the fastest.

And this is common regex terminology - man perlre and you will
find discussion of "greedy" vs. "stingy" matching.

Read what you quoted again. Everyone (Xah, vermicule, myself) was talking
about "greedy" as it's used in graph search and optimization algorithms.
 
A

alex goldman

Lawrence said:
However the original quote was in the context of regular expressions, so
discussion of the terminology used in regular expressions is far more
relevant than the terminology used in graph search and optimisation
algorithms.

I replied to "And from memory, that is the sort of thing done in Computing
101 and in Data Structures and Algorithms 101", and I fully explained what
I meant by "greedy" as well. There was no ambiguity.
 
L

Lawrence Kirby

Sean Burke wrote:
....


Read what you quoted again. Everyone (Xah, vermicule, myself) was talking
about "greedy" as it's used in graph search and optimization algorithms.

However the original quote was in the context of regular expressions, so
discussion of the terminology used in regular expressions is far more
relevant than the terminology used in graph search and optimisation
algorithms.

Lawrence
 
L

Lawrence Kirby

Lawrence Kirby wrote:
....


I replied to "And from memory, that is the sort of thing done in Computing
101 and in Data Structures and Algorithms 101", and I fully explained what
I meant by "greedy" as well. There was no ambiguity.

My response talks about relevance, not ambiguity.

Lawrence
 
K

Keith Thompson

alex goldman said:
Lawrence Kirby wrote: [snip]
My response talks about relevance, not ambiguity.

Well, your response was irrelevant.

This entire discussion is irrelevant to most, if not all, of the
newsgroups to which it's being posted. comp.lang.c, where I'm reading
this, is for discussion of the C programming language; I see nothing
about C.
 
X

xah

HTML Problems in Python Doc

I don't know what kind of system is used to generate the Python docs,
but it is quite unpleasant to work with manually, as there are
egregious errors and inconsistencies.

For example, on the “Module Contents†page (
http://python.org/doc/2.4/lib/node111.html ), the closing tags for <dd>
are never used, and all the tags are in lower case. However, on the
regex syntax page ( http://python.org/doc/2.4/lib/re-syntax.html ), the
closing tages for <dd> are given, and all tages are in caps.

The doc's first lines declare a type of:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

yet in the files they uses "/>" to close image tags, which is a XHTML
syntax.

the doc litters <p> and never closes them, making it a illegal
XML/XHTML by breaking the minimal requirement of well-formedness.

Asides from correctness, the code is quite bloated as is generally true
of generated HTML. For example, it is littered with: <tt id='l2h-853'
xml:id='l2h-853'> which isn't used in the style sheet, and i don't
think those ids can serve any purpose other than in style sheet.

Although the doc uses a huge style sheet and almost every tag comes
with a class or id attribute, but it also profusively uses hard-coded
style tags like <b>, <big> and Netcsape's <nobr>.

It also abuse tables that effectively does nothing. Here's a typical
line:
<table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-851' xml:id='l2h-851'
class="function">compile</tt></b>(</nobr></td>
<td><var>pattern</var><big>[</big><var>,
flags</var><big>]</big><var></var>)</td></tr></table>


If Python is supposed to be a quality language, then its
documentation's content and code seems to indicate otherwise.

This post is archived at:
http://xahlee.org/perl-python/re-write_notes.html

Xah
(e-mail address removed)
∑ http://xahlee.org/
 
K

Keith Thompson

HTML Problems in Python Doc
[snip]

+-------------------+ .:\:\:/:/:.
| PLEASE DO NOT | :.:\:\:/:/:.:
| FEED THE TROLLS | :=.' - - '.=:
| | '=(\ 9 9 /)='
| Thank you, | ( (_) )
| Management | /`-vvv-'\
+-------------------+ / \
| | @@@ / /|,,,,,|\ \
| | @@@ /_// /^\ \\_\
@x@@x@ | | |/ WW( ( ) )WW
\||||/ | | \| __\,,\ /,,/__
\||/ | | | jgs (______Y______)
/\/\/\/\/\/\/\/\//\/\\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
==============================================================
 
C

CBFalconer

HTML Problems in Python Doc

I don't know what kind of system is used to generate the Python docs,
but it is quite unpleasant to work with manually, as there are
egregious errors and inconsistencies.

PLONK for egregious cross-posting of off-topic nonsense.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top