]> granicus.if.org Git - python/commitdiff
shlex.split() now has an optional "posix" parameter.
authorGeorg Brandl <georg@python.org>
Thu, 24 May 2007 16:49:29 +0000 (16:49 +0000)
committerGeorg Brandl <georg@python.org>
Thu, 24 May 2007 16:49:29 +0000 (16:49 +0000)
Doc/lib/libshlex.tex
Lib/shlex.py
Misc/NEWS

index 451615f886e8cf734564a5de881c66c78286a6a3..23babd3ccbe188778eda1a3fd0ffd64f09bbc8a5 100644 (file)
@@ -19,13 +19,15 @@ files for Python applications) or for parsing quoted strings.
 
 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:
index 6632b87596047c55d75d1b2d739c355f17807c9f..fa18bb95e47c6ee71676694adc09adc461a9fb3b 100644 (file)
@@ -271,8 +271,8 @@ class shlex:
             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 = ''
index 1b027f9aaa03f5ccf3338785a810e90e560c8f06..71cdeafc364974b122fe2bcf03cfb919347c2c60 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -217,6 +217,8 @@ Core and builtins
 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