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 apalala
Recipients Paweł Miech, alex, apalala, georg.brandl, giampaolo.rodola, gregory.p.smith, rhettinger, santoso.wijaya, serhiy.storchaka, terry.reedy, tshepang, uwinx
Date 2021-02-26.15:28:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1614353336.21.0.57142441782.issue17343@roundup.psfhosted.org>
In-reply-to
Content
def isplit(text, sep=None, maxsplit=-1):
    """
    A lowmemory-footprint version of:

        iter(text.split(sep, maxsplit))

    Adapted from https://stackoverflow.com/a/9770397
    """

    if maxsplit == 0:
        yield text
    else:
        rsep = re.escape(sep) if sep else r'\s+'
        regex = fr'(?:^|{rsep})((?:(?!{rsep}).)*)'

        for n, p in enumerate(re.finditer(regex, text)):
            if 0 <= maxsplit <= n:
                yield p.string[p.start(1):]
                return
            yield p.group(1)
History
Date User Action Args
2021-02-26 15:28:56apalalasetrecipients: + apalala, georg.brandl, rhettinger, terry.reedy, gregory.p.smith, giampaolo.rodola, alex, santoso.wijaya, tshepang, serhiy.storchaka, Paweł Miech, uwinx
2021-02-26 15:28:56apalalasetmessageid: <1614353336.21.0.57142441782.issue17343@roundup.psfhosted.org>
2021-02-26 15:28:56apalalalinkissue17343 messages
2021-02-26 15:28:56apalalacreate