[issue43280] additional argument for str.join()
Steven D'Aprano
report at bugs.python.org
Sat Feb 20 20:46:22 EST 2021
Steven D'Aprano <steve+python at pearwood.info> added the comment:
Looking more closely, I think that the semantics are to concatenate the extra argument to the second-last item:
", ".join(["a", "b", "c"])
# -> "a, b, c"
", ".join(["a", "b", "c"], ", and")
# -> "a, b, and, c"
which would be the same as:
", ".join(["a", "b, and", "c"])
# -> "a, b, and, c"
I'm not sure how this is useful. In English, there should never be a comma after the "and", and there possibly shouldn't be a comma after the "b" either, depending on context.
# Should be: "a, b and c" or "a, b, and c"
See the Oxford or serial comma:
https://thegrammargirls.wordpress.com/tag/oxford-comma/
I'm going to close this feature request. It's too specific and the semantics don't seem to be very useful. But if you would still like to propose this, or a similar change, please discuss it first either on the Python-Ideas mailing list:
https://mail.python.org/archives/list/python-ideas@python.org/
or at the Ideas topic on
https://discuss.python.org
so that we can determine the required semantics and get a sense for how useful it would be in general.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43280>
_______________________________________
More information about the Python-bugs-list
mailing list