Message329310
The newly added shlex.punctuation_chars is special compared to the other public instance variables: It can ONLY be used when constructing a shlex instance, unlike other public instance variables, such as commenters, which can ONLY be set later.
>>> s = shlex.shlex('abc // def')
>>> s.commenters = '/'
>>> list(s)
['abc', '', '']
>>> s = shlex.shlex('abc // def', punctuation_chars = '/')
>>> list(s)
['abc', '//', 'def']
However, setting punctuation_chars later shows this rather useless error message:
>>> s = shlex.shlex('abc // def')
>>> s.punctuation_chars = '/'
>>> list(s)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/python/3.7.1/lib/python3.7/shlex.py", line 295, in __next__
token = self.get_token()
File "/opt/python/3.7.1/lib/python3.7/shlex.py", line 105, in get_token
raw = self.read_token()
File "/opt/python/3.7.1/lib/python3.7/shlex.py", line 133, in read_token
if self.punctuation_chars and self._pushback_chars:
AttributeError: 'shlex' object has no attribute '_pushback_chars' |
|
Date |
User |
Action |
Args |
2018-11-05 17:32:14 | tphh | set | recipients:
+ tphh |
2018-11-05 17:32:14 | tphh | set | messageid: <1541439134.06.0.788709270274.issue35168@psf.upfronthosting.co.za> |
2018-11-05 17:32:14 | tphh | link | issue35168 messages |
2018-11-05 17:32:13 | tphh | create | |
|