Re: name for new Enum decorator
On 6 Jun 2021, at 16:58, Andrei Kulakov <andrei.avk@gmail.com> wrote:
In Math / CompSci there is a definition that almost exactly matches this: Exact Cover - https://en.wikipedia.org/wiki/Exact_cover
The difference is that, IIRC, solving the problem is finding and removing all subsets that are unneeded to create an exact cover, so it's kind of arriving at it from a different direction, but 'exact cover' definition itself is a good match.
I’m not sure it’s a quite the same - it doesn’t require that the sets in the cover have cardinality 1, which I think Ethan does. And the ‘exact’ requirement (that each bit is covered once) surely doesn’t apply. It’s more like “full cover by singletons”.
On 6/6/21 9:14 AM, Irit Katriel via Python-Dev wrote:
On 6 Jun 2021, at 16:58, Andrei Kulakov wrote:
In Math / CompSci there is a definition that almost exactly matches this: Exact Cover - https://en.wikipedia.org/wiki/Exact_cover
The difference is that, IIRC, solving the problem is finding and removing all subsets that are unneeded to create an exact cover, so it's kind of arriving at it from a different direction, but 'exact cover' definition itself is a good match.
I’m not sure it’s a quite the same - it doesn’t require that the sets in the cover have cardinality 1, which I think Ethan does.
Well, I'm not sure what "cardinality 1" means, so I don't know if I do or not. :) -- ~Ethan~
On Mon, Jun 7, 2021 at 1:36 PM Ethan Furman <ethan@stoneleaf.us> wrote:
On 6/6/21 9:14 AM, Irit Katriel via Python-Dev wrote:
On 6 Jun 2021, at 16:58, Andrei Kulakov wrote:
In Math / CompSci there is a definition that almost exactly matches this: Exact Cover - https://en.wikipedia.org/wiki/Exact_cover
The difference is that, IIRC, solving the problem is finding and removing all subsets that are unneeded to create an exact cover, so it's kind of arriving at it from a different direction, but 'exact cover' definition itself is a good match.
I’m not sure it’s a quite the same - it doesn’t require that the sets in the cover have cardinality 1, which I think Ethan does.
Well, I'm not sure what "cardinality 1" means, so I don't know if I do or not. :)
It means each bit flag has only one bit set. In the 'exact cover' definition, that's not a requirement (if it were, it would make the problem too trivial to solve).
I also want to mention that 'exact cover' seems a very direct, easy to remember name also for users who are not familiar with the Math definition.. -andrei
Andrei is suggesting to look at each enum value as the set of "bits set to 1" in this value, and then apply a set-thoery term to the problem. A set of "cardinality 1" in this context is an enum value with only one "1", what you called canonical. The condition you defined is that any bit that is set anywhere, is also in a canonical value. Anyway, I don't know whether this kind of terminology is widely accessible. Maybe you could use something like @composite. As in, every non-canonical value in the enum is the composition of canonical values. On Mon, Jun 7, 2021 at 6:36 PM Ethan Furman <ethan@stoneleaf.us> wrote:
On 6/6/21 9:14 AM, Irit Katriel via Python-Dev wrote:
On 6 Jun 2021, at 16:58, Andrei Kulakov wrote:
In Math / CompSci there is a definition that almost exactly matches this: Exact Cover - https://en.wikipedia.org/wiki/Exact_cover
The difference is that, IIRC, solving the problem is finding and removing all subsets that are unneeded to create an exact cover, so it's kind of arriving at it from a different direction, but 'exact cover' definition itself is a good match.
I’m not sure it’s a quite the same - it doesn’t require that the sets in the cover have cardinality 1, which I think Ethan does.
Well, I'm not sure what "cardinality 1" means, so I don't know if I do or not. :)
-- ~Ethan~ _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/BMCG6MA3... Code of Conduct: http://python.org/psf/codeofconduct/
Irit Katriel via Python-Dev writes:
Andrei is suggesting to look at each enum value as the set of "bits set to 1" in this value, and then apply a set-thoery term to the problem. [...] Anyway, I don't know whether this kind of terminology is widely accessible.
I think the everyday meaning of "cover" is close enough to the set theory meaning that only set theorists can be confused. (Not a joke, because I'm not sure exactly what Ethan intends.) I'm not sure "exact_cover" or "complete_cover" or similar are good names, but they're as good as any I've seen so far.
Maybe you could use something like @composite. As in, every non-canonical value in the enum is the composition of canonical values.
-1 on "composite". "Compose" has other, more important meanings, and isn't very suggestive of this kind of factorization, to me at least. Steve
participants (4)
-
Andrei Kulakov
-
Ethan Furman
-
Irit Katriel
-
Stephen J. Turnbull