[Python-ideas] a set of enum.Enum values rather than the construction of bit-sets as the "norm"?

Random832 random832 at fastmail.com
Wed Jan 3 10:24:36 EST 2018


On Sun, Dec 31, 2017, at 00:33, Guido van Rossum wrote:
> I'm not keen on this recommendation. An argument that takes a Set[Foo]
> would mean that in order to specify:
> - no flags: you'd have to pass set() -- you can't use {} since that's an
> empty dict, not an empty set

Optional[Set[Foo]]?

> - one flag: you'd have to pass {Foo.BAR} rather than just Foo.BAR
> - two flags: you'd have to pass {Foo.BAR, Foo.BAZ} rather than Foo.BAR |
> Foo.BAZ

Maybe the flags themselves should be of a type that you can do both with (i.e. each value is a set containing itself).


More information about the Python-ideas mailing list