[Python-checkins] r54794 - sandbox/trunk/pep0/pep0.py

brett.cannon python-checkins at python.org
Thu Apr 12 23:38:14 CEST 2007


Author: brett.cannon
Date: Thu Apr 12 23:38:09 2007
New Revision: 54794

Modified:
   sandbox/trunk/pep0/pep0.py
Log:
Fix handling of names that end in 'Jr.' and such.


Modified: sandbox/trunk/pep0/pep0.py
==============================================================================
--- sandbox/trunk/pep0/pep0.py	(original)
+++ sandbox/trunk/pep0/pep0.py	Thu Apr 12 23:38:09 2007
@@ -70,7 +70,15 @@
         # Watch out for commas separating multiple names.
         regex += '(,\s+)?'
         for match in re.finditer(regex, data):
-            authors.append(match.group('author'))
+            author = match.group('author')
+            # Watch out for suffixes like 'Jr.' when they are comma-separated
+            # from the name and thus cause issues when *all* names are only
+            # separated by commas.
+            author = match.group('author')
+            if not author.partition(' ')[1] and author.endswith('.'):
+                prev_author = authors.pop()
+                author = ', '.join([prev_author, author])
+            authors.append(author)
         else:
             # If authors were found then stop searching.
             if authors:


More information about the Python-checkins mailing list