Code Comments
Programming Forum and web based access to our favorite programming groups.Let me expose one another XXXXing 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: =E2=80=9CIn other words, the "|" operator is never greedy.=E2=80=9D Note the need to inject the high-brow jargon =E2=80=9Cgreedy=E2=80=9D here = as a latch on sentence. =E2=80=9Cnever greedy=E2=80=9D? What is greedy anyway? =E2=80=9CGreedy=E2=80=9D, 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 =E2=80=9Cgreedy=E2=80=9D. It's not greedy Py= thon 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, =E2=80=9CUniversal Modeling Language=E2=80=9D, XXXXing shits. ---- A better writen doc for the complete regex module is at: http://xahlee.org/perl-python/pytho.../module-re.html See also: Responsible Software Licensing http://xahlee.org/UnixResource_dir/...le_license.html Xah xah@xahlee.org =E2=88=91 http://xahlee.org/
Post Follow-up to this messageOn 7 May 2005 16:40:01 -0700, in comp.lang.c , "Xah Lee" <xah@xahlee.org> wrote: >Let me expose one another XXXXing incompetent part of Python doc, if you really must speak in tongues, at least do it in private. now fsck off already. -- Mark McIntyre CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html> CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt> ----== Posted via mcse.ms - Unlimited-Uncensored-Secure Usenet News==- --- http://www.mcse.ms The #1 Newsgroup Service in the World! 120,000+ New sgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Post Follow-up to this messageHTML 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 =E2=80=9CModule Contents=E2=80=9D 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=3D'l2h-853' xml:id=3D'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=3D"0" cellspacing=3D"0"><tr valign=3D"baseline"> <td><nobr><b><tt id=3D'l2h-851' xml:id=3D'l2h-851' class=3D"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 xah@xahlee.org =E2=88=91 http://xahlee.org/
Post Follow-up to this messagexah@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) kst-u@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.
Post Follow-up to this messagexah@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
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.