[Python-ideas] Include partitioning in itertools
Sven R. Kunze
srkunze at mail.de
Tue Nov 3 11:58:31 EST 2015
Hey Lukas,
I agree both version (+ the n-part-partition-version of it) might be
very useful to have.
But where do they go into?
itertools might be the right place for the iter_partition; but where to
with the set_partition?
Best,
Sven
On 01.11.2015 19:30, Lukas Juhrich wrote:
> -----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-----
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
More information about the Python-ideas
mailing list