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

SourceForge.net noreply at sourceforge.net
Sat Sep 6 15:13:57 EDT 2003


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

Category: Documentation
Group: None
Status: Open
Resolution: None
>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: Brett Cannon (bcannon)
Date: 2003-09-06 14: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