Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > [perl-python] Python documentation moronicities (continued)

Reply
Thread Tools

[perl-python] Python documentation moronicities (continued)

 
 
Skip Montanaro
Guest
Posts: n/a
 
      05-09-2005

Peter> And which, at least implicitly, defines "greedy" by in section
Peter> 6.3 titled "Greedy versus Non-Greedy". It's not perfect, but
Peter> then nobody in this thread has offered anything even remotely
Peter> resembling perfect documentation for regular expressions
Peter> yet. <wink>

In the re syntax page:

http://www.python.org/dev/doc/devel/lib/re-syntax.html

the *?, +? and ?? operators *, + and ? are described as greedy:

*?, +?, ??
The "*", "+", and "?" qualifiers are all greedy; they match as much
text as possible. Sometimes this behaviour isn't desired; if the RE
<.*> is matched against '<H1>title</H1>', it will match the entire
string, and not just '<H1>'. Adding "?" after the qualifier makes it
perform the match in non-greedy or minimal fashion; as few
characters as possible will be matched. Using .*? in the previous
expression will match only '<H1>'.

{m,n}? is also described as a non-greedy version of {m,n} and A|B is
described as never being greedy (if A matches, B is never tried). Perhaps
there's no explicit definition of the word "greedy" in the context of
regular expressions, but I think that after reading that page most people
will at least have an intuitive notion of the meaning. If it's still
unclear, a little experimentation should suffice:

>>> import re
>>> re.match("(a+)", "aaaaa").group(1)

'aaaaa'
>>> re.match("(a+?)", "aaaaa").group(1)

'a'

In short, I think the re docs are fine as-is w.r.t. the greedy concept. I
also added a definition to the Python Glossary for good measure:

http://www.python.org/moin/PythonGlossary

Feel free to amend/enhance/correct as you see fit. (Feel free to flesh out
any definitions for that matter, especially those with "???" as the
definition.)

Skip
 
Reply With Quote
 
 
 
 
Fredrik Lundh
Guest
Posts: n/a
 
      05-09-2005
Mike Meyer wrote:

> After doing a google for "regular expression greedy", the second match
> starts with the text:
>
> By default, pattern matching is greedy, which means that the matcher
> returns the longest match possible.
>
> Now, it can be argued that the term ought not to be used, except that
> it's a standard term with a well-known meaning, and exactly describes
> the behavior in question.


fwiw, judging from frequently asked questions and bug reports,
people have no problems understanding the phrase "greedy", but
they sometimes have problems understanding why "return the
longest match possible" doesn't always mean "return the overall
longest match possible"

(using the greedy modifier only applies to the given RE operator;
it doesn't modify the behaviour of other operators, or the method
used; e.g. | will still pick the *first* possible match even if one of
the alternatives use a greedy operator, search/find still scans the
target string from left to right, etc).

</F>



 
Reply With Quote
 
 
 
 
Xah Lee
Guest
Posts: n/a
 
      05-13-2005
> I think you will continue to have
> difficulty getting respect on this
> matter as long as you show disrespect
> to those who have come before you.
> ...


Dear Ron Adam and other good people,

I respect people and I respect truth. And, the priority is truth first.

The software community, is one ****ed up ball, and in part, because
people respect not people nor truth. They respect their own asses,
euphorimically known as politics and power game, and exhibited and
understood as respecting other people.

the above, as you've seen, can be seen in the behaviors and inactions
in this python group as judged by its posts on the Python doc issue i
raised. (of course there are also posts by good hearted and educated
people)

The documentations in computing industry and The Python doc in
particular, is one gravely ****ing incompetent ball. And, execuse me
that most people do not understand this, but it is because people
respects their own asses more than other people or truth as i outlined
above.

The ****ed up writings and thinkings in the computing industry is in
part what causes the sorry situation of today's software.

I, am taking my time as time permits to explain this situation little
by little to the computing public, message by message.

As to my criticism and rewrite of Python doc in particular, the Python
community can take it or leave it. If they take it, or if i instigated
any change, they shall give proper credit where credit is due.

-----
To the generic Python community:

go re-read my posts, and this time pay attention:
http://xahlee.org/Periodic_dosage_di...ami_cukta.html
http://xahlee.org/perl-python/re-write_notes.html

These writings and my involvement with Python will probably only
increase. It is beneficial for you, either personally or as part of the
Python collective, to behave properly.

Xah
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://xahlee.org/





Newsgroups: comp.lang.python
From: Ron Adam <(E-Mail Removed)> - Find messages by this author
Date: Sat, 07 May 2005 20:23:35 -0400
Local: Sat,May 7 2005 8:23*pm
Subject: Re: New Python regex Doc
Reply | Reply to Author | Forward | Print | Individual Message |
Show original | Report Abuse

Xah Lee wrote:
> Let me expose one another fu....


Hello Xah,

I think you will continue to have difficulty getting respect on this
matter as long as you show disrespect to those who have come before
you.

When you refer to the documentation as being f'ing stupid, and other
disrespectful terms, you are in an indirect, or depending on your
intent, directly insulting the people who have done their best, as
*volunteers* in most cases, to provide the existing documentation.

Text is never F'ing, Stupid, or any of the other terms you refer to as
it being. *However it can be uninformative, hard to read, confusing,
and
even plain wrong. *But it is only text, and does not have a mind of
it's
own. *Referring to it as if it does, in such angry tones, reflects
back
on yourself and gives others a poor impression of you.

At the start, you choose to approach this matter as a personal and
competitive agenda, ie.. You vs those who came before you. *Is this
really the correct way to do this? *You don't have to insult those
who
came before you in order to make your case. *If you do, then maybe
your
case isn't strong enough. *But even this is wrong because it isn't a
competition.

I suppose that if you respectfully offer something even a little better
it would be respectfully accepted, after due review of course. *You
will
probably even get many helpful suggestions along they way because you
will have created a situation where every one wins.

But by approaching it in the way you are, you make it very hard for
people to support you, because to do so, they have to take on the role
of losers in order for you to be a winner.

Just some thoughts, you might consider.

Cheers, and good luck with whatever aproach you decide.

 
Reply With Quote
 
John Bokma
Guest
Posts: n/a
 
      05-13-2005
Xah Lee wrote:

> I respect people


and I was convinced he was going to show different:

> The software community, is one ****ed up ball, and in part, because


just one person sees the light...

> people respect not people nor truth. They respect their own asses,


Then you must be the #1 fine example of that same ****ed up ball.

> raised. (of course there are also posts by good hearted and educated
> people)


Like yourself, sure.

If you had really any point, you didn't need to swear in every third
sentence. Nor bother so many groups with your rants.

If you think it can be done better, pick up a part of documentation, and
rewrite it. To make it very hard, you are not allowed to use ****, ****ing,
****ed, ass, asses or other similar words, which in the way you use them
show quite some lack of both creativity and writing skills.

--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html

 
Reply With Quote
 
axel@white-eagle.co.uk
Guest
Posts: n/a
 
      05-13-2005
In comp.lang.perl.misc John Bokma <(E-Mail Removed)> wrote:
> If you had really any point, you didn't need to swear in every third
> sentence. Nor bother so many groups with your rants.


> If you think it can be done better, pick up a part of documentation, and
> rewrite it. To make it very hard, you are not allowed to use ****, ****ing,
> ****ed, ass, asses or other similar words, which in the way you use them
> show quite some lack of both creativity and writing skills.


Oh please let him use an ass... then we might not see him again for
several months nutil his donley comes over the hill.

Axel


 
Reply With Quote
 
John Bokma
Guest
Posts: n/a
 
      05-13-2005
wrote:

> In comp.lang.perl.misc John Bokma <(E-Mail Removed)> wrote:


[ @55, |@#~~|!! ]

> Oh please let him use an ass...


Ok, he is allowed to use ass in examples, e.g. (Perl)

s/ass/domesticated donkey/g;

(Maybe to explain \b ? )

--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
converting XSD documentation to HTML documentation kev.sully@gmail.com XML 1 09-16-2006 12:09 PM
[perl-python] Python documentation moronicities (continued) Xah Lee Perl Misc 27 05-13-2005 04:28 PM
Python documentation: How about structured documentation? Looking for comments/suggestions Kenneth McDonald Python 2 05-06-2004 04:11 AM
Principles of documentation (was: Python Documentation Blows!) Cameron Laird Python 1 04-03-2004 06:54 PM
LyX for Python Documentation Stuart D. Gathman Python 0 07-15-2003 05:07 PM



Advertisments