Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add str.split_iter function #86982

Closed
uwinx mannequin opened this issue Jan 3, 2021 · 4 comments
Closed

Add str.split_iter function #86982

uwinx mannequin opened this issue Jan 3, 2021 · 4 comments
Labels
3.10 only security fixes topic-unicode type-feature A feature request or enhancement

Comments

@uwinx
Copy link
Mannequin

uwinx mannequin commented Jan 3, 2021

BPO 42816
Nosy @vstinner, @ezio-melotti, @stevendaprano, @serhiy-storchaka, @uwinx
Superseder
  • bpo-17343: Add a version of str.split which returns an iterator
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-01-03.13:58:27.803>
    created_at = <Date 2021-01-03.13:09:42.457>
    labels = ['type-feature', '3.10', 'expert-unicode']
    title = 'Add str.split_iter function'
    updated_at = <Date 2021-01-03.13:58:27.802>
    user = 'https://github.com/uwinx'

    bugs.python.org fields:

    activity = <Date 2021-01-03.13:58:27.802>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-01-03.13:58:27.803>
    closer = 'serhiy.storchaka'
    components = ['Unicode']
    creation = <Date 2021-01-03.13:09:42.457>
    creator = 'uwinx'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 42816
    keywords = []
    message_count = 4.0
    messages = ['384270', '384274', '384275', '384276']
    nosy_count = 5.0
    nosy_names = ['vstinner', 'ezio.melotti', 'steven.daprano', 'serhiy.storchaka', 'uwinx']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '17343'
    type = 'enhancement'
    url = 'https://bugs.python.org/issue42816'
    versions = ['Python 3.10']

    @uwinx
    Copy link
    Mannequin Author

    uwinx mannequin commented Jan 3, 2021

    Split string by given separator and return iterator as a result.

    The naive and not very efficient solution would be using current str.split:

    def split_iter(self: str, sep: str) -> 'Iterator[str]':
        return iter(self.split(sep))

    Probably, need we'll some better solution without allocating new list.

    @uwinx uwinx mannequin added 3.10 only security fixes topic-unicode type-feature A feature request or enhancement labels Jan 3, 2021
    @stevendaprano
    Copy link
    Member

    I am pretty sure this has been discussed and rejected on the Python-Ideas mailing list before.

    If not rejected, the idea didn't go very far. You may wish to search the mailing list archives for previous discussions.

    Either way, I think this should be discussed on Python-Ideas, to see if there is a consensus on this, and whether or not this is a large enough change that it needs a PEP.

    @stevendaprano
    Copy link
    Member

    See also discussion here: bpo-17343

    @serhiy-storchaka
    Copy link
    Member

    bpo-17343 mentions also a separate method str.itersplit, so I close this issue as a duplicate.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.10 only security fixes topic-unicode type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants