[Python-ideas] Include partitioning in itertools
Albert ten Oever
agtoever at hotmail.com
Sun Nov 1 06:08:44 EST 2015
Hi all,
I really hope this isn't proposed before - I couldn't find anything in the archives.
I want to propose to include a 'partition' (mathematically more correct: a set partition) function in itertools. To my knowledge, partitioning of a set (iterable) is quite a common thing to do and a logic extension of the combinatoric generators in itertools.
It is implemented as a Python recipe (http://code.activestate.com/recipes/576795-partitioning-a-sequence/). I found that implementing a partition generator of an iterable isn't very straightforward, which, in my opinion, strengthens the case for implementing it as a separate function.
Definitions of partitions: http://mathworld.wolfram.com/SetPartition.html or https://en.wikipedia.org/wiki/Partition_of_a_set
Humble regards,
Albert.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20151101/2650b5d4/attachment.html>
More information about the Python-ideas
mailing list