[Python-checkins] cpython (3.4): Issue #21232: Replace .splitlines arg '1' with 'keepends=True'.

terry.reedy python-checkins at python.org
Fri Apr 18 23:01:33 CEST 2014


http://hg.python.org/cpython/rev/604b74f9a07d
changeset:   90407:604b74f9a07d
branch:      3.4
parent:      90405:02fec733f760
user:        Terry Jan Reedy <tjreedy at udel.edu>
date:        Fri Apr 18 17:00:19 2014 -0400
summary:
  Issue #21232: Replace .splitlines arg '1' with 'keepends=True'.

files:
  Doc/library/difflib.rst |  12 ++++++------
  1 files changed, 6 insertions(+), 6 deletions(-)


diff --git a/Doc/library/difflib.rst b/Doc/library/difflib.rst
--- a/Doc/library/difflib.rst
+++ b/Doc/library/difflib.rst
@@ -226,8 +226,8 @@
 
    :file:`Tools/scripts/ndiff.py` is a command-line front-end to this function.
 
-      >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(1),
-      ...              'ore\ntree\nemu\n'.splitlines(1))
+      >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True),
+      ...              'ore\ntree\nemu\n'.splitlines(keepends=True))
       >>> print(''.join(diff), end="")
       - one
       ?  ^
@@ -250,8 +250,8 @@
 
    Example:
 
-      >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(1),
-      ...              'ore\ntree\nemu\n'.splitlines(1))
+      >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True),
+      ...              'ore\ntree\nemu\n'.splitlines(keepends=True))
       >>> diff = list(diff) # materialize the generated delta into a list
       >>> print(''.join(restore(diff, 1)), end="")
       one
@@ -650,7 +650,7 @@
    ...   2. Explicit is better than implicit.
    ...   3. Simple is better than complex.
    ...   4. Complex is better than complicated.
-   ... '''.splitlines(1)
+   ... '''.splitlines(keepends=True)
    >>> len(text1)
    4
    >>> text1[0][-1]
@@ -659,7 +659,7 @@
    ...   3.   Simple is better than complex.
    ...   4. Complicated is better than complex.
    ...   5. Flat is better than nested.
-   ... '''.splitlines(1)
+   ... '''.splitlines(keepends=True)
 
 Next we instantiate a Differ object:
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list