This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Dennis Sweeney
Recipients Dennis Sweeney
Date 2020-03-12.06:32:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1583994723.34.0.552353280143.issue39944@roundup.psfhosted.org>
In-reply-to
Content
It seems that `.join` methods typically return the type of the separator on which they are called:

    >>> bytearray(b" ").join([b"a", b"b"])
    bytearray(b'a b')
    >>> b" ".join([bytearray(b"a"), bytearray(b"b")])
    b'a b'

This is broken in UserString.join:

    >>> from collections import UserString as US
    >>> x = US(" ").join(["a", "b"])
    >>> type(x)
    <class 'str'>

Furthermore, this method cannot even accept UserStrings from the iterable:

    >>> US(" ").join([US("a"), US("b")])
    Traceback (most recent call last):
    ...
    TypeError: sequence item 0: expected str instance, UserString found.

I can submit a PR to fix this.
History
Date User Action Args
2020-03-12 06:32:03Dennis Sweeneysetrecipients: + Dennis Sweeney
2020-03-12 06:32:03Dennis Sweeneysetmessageid: <1583994723.34.0.552353280143.issue39944@roundup.psfhosted.org>
2020-03-12 06:32:03Dennis Sweeneylinkissue39944 messages
2020-03-12 06:32:03Dennis Sweeneycreate