shlex.split != shlex.shlex get_token til eof

p.lavarre at ieee.org p.lavarre at ieee.org
Tue Sep 26 18:30:26 EDT 2006


Kindly offline the answer is:

(a) Python installation usually includes source, and thus
(b) UTSL:

$ pwd
C:\Python25\Lib\shlex.py
$ ...
$ pwd
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
$ grep -A 5 "def split" shlex.py
def split(s, comments=False):
    lex = shlex(s, posix=True)
    lex.whitespace_split = True
    if not comments:
        lex.commenters = ''
    return list(lex)
$

Voila the THREE undocumented ways that shlex.split has been overriding
the shlex.shlex defaults: nothing in wordchars, yes something in
whitespace_split, but also stuff in commenters and in posix.  (Of
these, the posix override is documented.)




More information about the Python-list mailing list