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

Make chain.from_iterable an alias for a new chain_iterable. #62952

Closed
terryjreedy opened this issue Aug 15, 2013 · 4 comments
Closed

Make chain.from_iterable an alias for a new chain_iterable. #62952

terryjreedy opened this issue Aug 15, 2013 · 4 comments
Assignees
Labels
type-feature A feature request or enhancement

Comments

@terryjreedy
Copy link
Member

BPO 18752
Nosy @rhettinger, @terryjreedy, @ericvsmith, @merwok

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 = 'https://github.com/rhettinger'
closed_at = <Date 2013-09-09.07:10:18.604>
created_at = <Date 2013-08-15.21:05:59.329>
labels = ['type-feature']
title = 'Make chain.from_iterable an alias for a new chain_iterable.'
updated_at = <Date 2013-09-09.07:10:18.603>
user = 'https://github.com/terryjreedy'

bugs.python.org fields:

activity = <Date 2013-09-09.07:10:18.603>
actor = 'rhettinger'
assignee = 'rhettinger'
closed = True
closed_date = <Date 2013-09-09.07:10:18.604>
closer = 'rhettinger'
components = []
creation = <Date 2013-08-15.21:05:59.329>
creator = 'terry.reedy'
dependencies = []
files = []
hgrepos = []
issue_num = 18752
keywords = []
message_count = 4.0
messages = ['195290', '197348', '197349', '197353']
nosy_count = 5.0
nosy_names = ['rhettinger', 'terry.reedy', 'eric.smith', 'eric.araujo', 'python-dev']
pr_nums = []
priority = 'normal'
resolution = 'rejected'
stage = 'needs patch'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue18752'
versions = ['Python 3.4']

@terryjreedy
Copy link
Member Author

It has become apparent from various discussions in recent months that chain.from_iterable is at least as useful as chain. In fact, I now think that 'chain' should have been what chain.from_iterable is, with current chain(a,b,c) done as chain((a,b,d)). But too late for that.

Based on today's pydev post* by Eric Smith, I propose that chain_iterable (or chain_from_iterable, but I think the 'from' is not needed) be added to itertools and listed in the index table and documented as a function in its own right.

This would make the long discussion of how to properly document chain.from_iterable (bpo-18301) moot, as the method could be simply mentioned as a (deprecated) alias of chain_iterable.

  • "I think that [itertools.chain.from_iterable] was a mistake, too. As a
    recent discussion showed, it's not exactly discoverable. The fact that
    it's not mentioned in the list of functions at the top of the
    documentation doesn't help. And "chain" is documented as a "module
    function", and "chain.from_iterable" as a "classmethod" making it all
    the more confusing.

I think itertools.combinations and itertools.combinations_with_replacement is the better example of related
functions that should be followed. Not nested, no special parameters
trying to differentiate them: just two different function names."

If this proposal is rejected, then chain.iterable should be added to the index table. That would make it more discoverable, but not less confusing.

@terryjreedy terryjreedy added the type-feature A feature request or enhancement label Aug 15, 2013
@rhettinger rhettinger self-assigned this Sep 1, 2013
@rhettinger
Copy link
Contributor

I'll work on improving the docs to make this classmethod more discoverable in docs, but the API is going to stay the same.

@python-dev
Copy link
Mannequin

python-dev mannequin commented Sep 9, 2013

New changeset fa1fa88b685b by Raymond Hettinger in branch 'default':
bpo-18752: Make chain.from_iterable() more visible in the documentation.
http://hg.python.org/cpython/rev/fa1fa88b685b

@python-dev
Copy link
Mannequin

python-dev mannequin commented Sep 9, 2013

New changeset 23f77dc58979 by Raymond Hettinger in branch '3.3':
bpo-18752: Make chain.from_iterable() more visible in the documentation.
http://hg.python.org/cpython/rev/23f77dc58979

@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
type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants