[issue18301] In itertools.chain.from_iterable() there is no cls argument

2013-09-08 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- resolution: -> fixed status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue18301] In itertools.chain.from_iterable() there is no cls argument

2013-09-08 Thread Roundup Robot
Roundup Robot added the comment: New changeset 29fa1f418796 by Raymond Hettinger in branch '3.3': Issue 18301: The classmethod decorator didn't fit well with the rough-equivalent example code. http://hg.python.org/cpython/rev/29fa1f418796 -- nosy: +python-dev _

[issue18301] In itertools.chain.from_iterable() there is no cls argument

2013-08-15 Thread Terry J. Reedy
Terry J. Reedy added the comment: My counter proposal #18752 is that chain.from_iterable become a deprecated alias for a new function, chain_iterable. With '@classmethod' removed, the current Python equivalent would work for chain_iterable. -- ___

[issue18301] In itertools.chain.from_iterable() there is no cls argument

2013-08-08 Thread py.user
py.user added the comment: changed iter(arg) to *arg >>> import itertools >>> >>> class A(itertools.chain): ... @classmethod ... def from_iter(cls, arg): ... return cls(*arg) ... >>> class B(A): ... pass ... >>> B('ab', 'cd') <__main__.B object at 0x7fc280e93cd0> >>> b =

[issue18301] In itertools.chain.from_iterable() there is no cls argument

2013-08-08 Thread py.user
py.user added the comment: >>> import itertools >>> >>> class A(itertools.chain): ... def from_iter(arg): ... return A(iter(arg)) ... >>> class B(A): ... pass ... >>> B('a', 'b') <__main__.B object at 0x7f40116d7730> >>> B.from_iter(['a', 'b']) <__main__.A object at 0x7f40116d7

[issue18301] In itertools.chain.from_iterable() there is no cls argument

2013-08-08 Thread Ezio Melotti
Ezio Melotti added the comment: > I would just remove the decorator. +1 -- nosy: +ezio.melotti ___ Python tracker ___ ___ Python-bugs

[issue18301] In itertools.chain.from_iterable() there is no cls argument

2013-08-06 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: serhiy.storchaka -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Uns

[issue18301] In itertools.chain.from_iterable() there is no cls argument

2013-08-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It should be a classmethod. >>> import itertools >>> class C(itertools.chain): pass ... >>> type(C.from_iterable(['ab', 'cd'])) The patch LGTM. -- assignee: docs@python -> serhiy.storchaka stage: -> commit review _

[issue18301] In itertools.chain.from_iterable() there is no cls argument

2013-06-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Perhaps it should be staticmethod, not classmethod. -- nosy: +serhiy.storchaka ___ Python tracker ___

[issue18301] In itertools.chain.from_iterable() there is no cls argument

2013-06-28 Thread Terry J. Reedy
Terry J. Reedy added the comment: The 2.7 doc says 'Roughly equivalent to' rather than 'Equivalent to'. The undecorated Python version of from_iterable actually works as an attribute of the Python version of chain: chain.from_iterable = from_iterable. I would just remove the decorator. The enti

[issue18301] In itertools.chain.from_iterable() there is no cls argument

2013-06-25 Thread R. David Murray
R. David Murray added the comment: It is implemented as a classmethod, but the "equivalent" code doesn't need to be part of the class all. I'm not sure what should be done here (say @staticmethod? Leave the decorator off?). We should probably see what Raymond thinks. I lean toward the latt

[issue18301] In itertools.chain.from_iterable() there is no cls argument

2013-06-25 Thread py.user
py.user added the comment: http://docs.python.org/3/library/itertools.html#itertools.chain.from_iterable -- ___ Python tracker ___ ___

[issue18301] In itertools.chain.from_iterable() there is no cls argument

2013-06-25 Thread py.user
New submission from py.user: http://docs.python.org/2/library/itertools.html#itertools.chain.from_iterable >>> class A: ... @classmethod ... def from_iterable(iterables): ... for it in iterables: ... for element in it: ... yield element ... >>> A.from_iterable(['ABC', 'DEF