[Python-ideas] Include partitioning in itertools

Lukas Juhrich lukasjuhrich at wh2.tu-dresden.de
Sun Nov 1 13:30:09 EST 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi Sven,

The issue here is that such an implementation does not allow “gaps”
and implicitly enforces that the elements of such a partition only
contain elements directly following each other, thus making it not a
complete implementation of producing a set partition.  To give a
specific counterexample, `['acd', 'bef']` will never be produced.

The question to ask is whether you want to implement exact
mathematical set partition, or if you implement something with the
above constraint, and call it something different like “iterable
partition”.  If choosing the latter, however, it should be made clear
by the function name and in the documentation that this is *not*
comparable to set partition.

Perhaps it will be useful to implement both concepts, since such an
“iterable partition” seems to be easier to implement and will perhaps
be faster (which, however, is a blind guess and depends on the
implementation of producing a set partition).

- --
Sincerely,
Lukas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJWNlotAAoJENBP4KTXGFXeSJ8P/33IfUqVe+LqKjdjghOVrb2A
2wcj85GJHV5hu8UIYNfchVwvBML7w0LpgvHsopD7NkXLYepOy1AuSDTlePYZGu2g
TvVFLd861HZVAQFtFwuuY1bAkNlCDDtNOUZYrortkc7F05TFBaGiTu7Z7zrHG9PN
5eLZ7dpr5y9Ok8nCaerUVnxAn81+A+mr0O2KPAAOfTLA0C0bo4uWJsp1WJMcLF1N
o0RpzrZ68Qy1vzfnRaf5T/MpcxIFaPxTYee8wxg/pGse5gPJidvK83G5MV/ylHbK
INqG7iPTcD8DJ0OpvR/462QaxBf225fP3Dg+xUtKvpBw2SMrSfc8X9VXOE7EFMJ+
m9Wajx5d1+wVvlTzdEa5Nu5A7I5DGDO+zW7jeuZ2Ri6q6aeKHRt1JLsi/5VIJ+/B
0xb7/a5JKcjskrZuQrlCzVKlvOUq2Wf1SZKlPLq6jsB3xkT1qJhF2QssoR3s2aNn
998gwRl3sJzrdVh9+QxCXjoQ92aqQCLRsvHll+uZ9bjJEhD3SXlyFhqmhLf396fq
BMWpxFrSuf4ltqke2WQrzrvpJnxd1MH7yH+2tVQej8/kUHJyCWdBLZeQJeFljiJa
3zYh6BQ8KjwtjNcSHzmhANO/0FSwzVDPSvP2ocEbjYjv5WMXXk0/sNdRgsb3gkQ1
5zuBS6j2n5n9SeUZ0IcM
=Ki11
-----END PGP SIGNATURE-----


More information about the Python-ideas mailing list