Message387434
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. |
|
Date |
User |
Action |
Args |
2021-02-21 01:46:22 | steven.daprano | set | recipients:
+ steven.daprano, Dennis Sweeney, f-brinkmann |
2021-02-21 01:46:22 | steven.daprano | set | messageid: <1613871982.07.0.0263371425395.issue43280@roundup.psfhosted.org> |
2021-02-21 01:46:22 | steven.daprano | link | issue43280 messages |
2021-02-21 01:46:21 | steven.daprano | create | |
|