[Python-checkins] r55549 - in python/trunk: Doc/lib/libshlex.tex Lib/shlex.py Misc/NEWS

georg.brandl python-checkins at python.org
Thu May 24 18:49:36 CEST 2007


Author: georg.brandl
Date: Thu May 24 18:49:29 2007
New Revision: 55549

Modified:
   python/trunk/Doc/lib/libshlex.tex
   python/trunk/Lib/shlex.py
   python/trunk/Misc/NEWS
Log:
shlex.split() now has an optional "posix" parameter.


Modified: python/trunk/Doc/lib/libshlex.tex
==============================================================================
--- python/trunk/Doc/lib/libshlex.tex	(original)
+++ python/trunk/Doc/lib/libshlex.tex	Thu May 24 18:49:29 2007
@@ -19,13 +19,15 @@
 
 The \module{shlex} module defines the following functions:
 
-\begin{funcdesc}{split}{s\optional{, comments}}
+\begin{funcdesc}{split}{s\optional{, comments\optional{, posix}}}
 Split the string \var{s} using shell-like syntax. If \var{comments} is
 \constant{False} (the default), the parsing of comments in the given
 string will be disabled (setting the \member{commenters} member of the
 \class{shlex} instance to the empty string).  This function operates
-in \POSIX{} mode.
+in \POSIX{} mode by default, but uses non-\POSIX{} mode if the
+\var{posix} argument is false.
 \versionadded{2.3}
+\versionchanged[Added the \var{posix} parameter]{2.6}
 \end{funcdesc}
 
 The \module{shlex} module defines the following class:

Modified: python/trunk/Lib/shlex.py
==============================================================================
--- python/trunk/Lib/shlex.py	(original)
+++ python/trunk/Lib/shlex.py	Thu May 24 18:49:29 2007
@@ -271,8 +271,8 @@
             raise StopIteration
         return token
 
-def split(s, comments=False):
-    lex = shlex(s, posix=True)
+def split(s, comments=False, posix=True):
+    lex = shlex(s, posix)
     lex.whitespace_split = True
     if not comments:
         lex.commenters = ''

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Thu May 24 18:49:29 2007
@@ -217,6 +217,8 @@
 Library
 -------
 
+- shlex.split() now has an optional "posix" parameter.
+
 - The posixfile module now raises a DeprecationWarning.
 
 - Remove the gopherlib module.  This also leads to the removal of gopher


More information about the Python-checkins mailing list