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...module-re.html
See also: Responsible Software Licensing http://xahlee.org/UnixResource_dir/w...e_license.html
Xah xa*@xahlee.org
∑ http://xahlee.org/ 15 1398
"Xah Lee" <xa*@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.
Xah Lee wrote: 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
vermicule <ra****@bigpond.net.au> writes: "Xah Lee" <xa*@xahlee.org> writes:
[...] 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.
--
Mns Rullgrd mr*@inprovide.com
"Xah Lee" <xa*@xahlee.org> writes:
[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.
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
vermicule wrote: 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.
alex goldman <he***@spamm.er> writes: vermicule wrote:
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.
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
Sean Burke wrote: alex goldman <he***@spamm.er> writes:
vermicule wrote:
> > 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.
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.
On Tue, 10 May 2005 04:58:48 -0700, alex goldman wrote: Sean Burke wrote:
.... 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.
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
Lawrence Kirby wrote: On Tue, 10 May 2005 04:58:48 -0700, alex goldman wrote:
Sean Burke wrote:
...
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.
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.
On Tue, 10 May 2005 06:52:18 -0700, alex goldman wrote: Lawrence Kirby wrote:
.... 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.
My response talks about relevance, not ambiguity.
Lawrence
Lawrence Kirby wrote: On Tue, 10 May 2005 06:52:18 -0700, alex goldman wrote:
Lawrence Kirby wrote:
...
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.
My response talks about relevance, not ambiguity.
Well, your response was irrelevant.
alex goldman <he***@spamm.er> writes: 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.
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
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 xa*@xahlee.org
∑ http://xahlee.org/ xa*@xahlee.org writes: HTML Problems in Python Doc
[snip]
+-------------------+ .:\:\:/:/:.
| PLEASE DO NOT | :.:\:\:/:/:.:
| FEED THE TROLLS | :=.' - - '.=:
| | '=(\ 9 9 /)='
| Thank you, | ( (_) )
| Management | /`-vvv-'\
+-------------------+ / \
| | @@@ / /|,,,,,|\ \
| | @@@ /_// /^\ \\_\
@x@@x@ | | |/ WW( ( ) )WW
\||||/ | | \| __\,,\ /,,/__
\||/ | | | jgs (______Y______)
/\/\/\/\/\/\/\/\//\/\\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
================================================== ============
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this. xa*@xahlee.org wrote: 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.
--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Sridhar R |
last post by:
>From technical point of view, I could not understand the the reasoning
behind using Java in major companies. Sure that Python, is used in
some, but still Java is considered as a sure-job...
|
by: Andy |
last post by:
First of all, can I reassure you that this posting is NOT spam and not
market research. Please feel free to email me at the address below to
check/validate this message prior to doing the survey if...
|
by: Andy |
last post by:
First of all, can I reassure you that this posting is NOT spam and not
market research. Please feel free to email me at the address below to
check/validate this message prior to doing the survey if...
|
by: natty2006 |
last post by:
Submission Deadline extended: 13 November 2006
*************************************************************
IADIS INTERNATIONAL CONFERENCE
APPLIED COMPUTING 2007
February 17-20, 2007 -...
|
by: Xah Lee |
last post by:
Today, a motherfucker Christophe Rhodes (aka Xof in irc://chat.freenode.net/lisp
) kicked banned me.
Here's the few relevant excerpt. (full, unedited excerpt will be
published if there is a public...
|
by: Aaron Watters |
last post by:
So, in between skiing runs I noticed
a Business Week cover story on
"cloud computing". The article had
lots of interesting information in it like
about how somebody's mom used to
be an airline...
|
by: Ty Oft |
last post by:
Hello Bytes!
Maybe my question seems a bit silly (as one could simply answer it "Well, what are you more passionate about?" or stuff like that - please don't answer like this), but I am in a bit...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |