[Python-bugs-list] [ python-Bugs-800899 ] Making "|" directive from REs a bit clearer

SourceForge.net noreply at sourceforge.net
Tue Sep 9 21:56:07 EDT 2003


Bugs item #800899, was opened at 2003-09-05 01:59
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=800899&group_id=5470

Category: Documentation
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 3
Submitted By: Wojtek Walczak (gminick)
Assigned to: Nobody/Anonymous (nobody)
Summary: Making "|" directive from REs a bit clearer

Initial Comment:
Let's take a look, Library Reference, 4.2.1 Regular 

Expression Syntax says:



   "|"

           A|B, where A and B can be arbitrary REs, creates a 

regular

           expression that will match either A or B.

           [...]

!!here_starts_the_darkness!!

           REs separated by "|" are tried from left to right, and 

the

           first one that allows the complete pattern to match 

is considered

           the accepted branch. This means that if A matches, 

B will never

           be tested, even if it would produce a longer overall 

match.

!!here_ends_the_darkness!!



It's not as clear as it can be. For more information take a 

look at: 

<http://mail.python.org/pipermail/python-dev/2003-September/037924.html>



Here's a proposal from Terry Reedy for changing those 

lines from darkness ;-)



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





----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-09-09 22:56

Message:
Logged In: YES 
user_id=80475

Accepted and applied.

Thanks for the contribution.

----------------------------------------------------------------------

Comment By: Brett Cannon (bcannon)
Date: 2003-09-06 16:13

Message:
Logged In: YES 
user_id=357491

This was also brought to the attention of python-dev directly and 

discussed in the thread "Discordance in Documentation..." which 

can be found at http://mail.python.org/pipermail/python-dev/

2003-September/037924.html .

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=800899&group_id=5470



More information about the Python-bugs-list mailing list