Steven D'Aprano wrote:
> Is it silly to create an enumeration with only a single member? That is, a
> singleton enum?
>
> from enum import Enum
>
> class Unique(Enum):
> FOO = auto()
>
>
> The reason I ask is that I have two functions that take an enum argument.
> The first takes one of th
On 01/10/2017 05:43 AM, Steven D'Aprano wrote:
Is it silly to create an enumeration with only a single member? That is, a
singleton enum?
Don't think so, for the same reason that lists with one element make sense.
def ham(arg):
if isinstance(arg, MarxBros) or arg is Unique.FOO:
On 01/10/2017 12:37 AM, Chris Angelico wrote:
On Tue, Jan 10, 2017 at 7:33 PM, Paul Rubin wrote:
That is, a singleton enum?
Why stop there? You can make empty ones too. (Zerotons?)
Sure you *can*, but I can't think of any time they'd be useful. Can
you give an example?
Sure. Any time
On Tue, Jan 10, 2017 at 7:33 PM, Paul Rubin wrote:
>> That is, a singleton enum?
>
> Why stop there? You can make empty ones too. (Zerotons?)
Sure you *can*, but I can't think of any time they'd be useful. Can
you give an example?
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano writes:
> Is it silly to create an enumeration with only a single member?
No.
> That is, a singleton enum?
Why stop there? You can make empty ones too. (Zerotons?)
> The reason I ask is that I have two functions that take an enum
> argument.
Sounds like a good reason.
>
Steven D'Aprano writes:
> Is it silly to create an enumeration with only a single member? That
> is, a singleton enum?
>
> from enum import Enum
>
> class Unique(Enum):
> FOO = auto()
>
>
> The reason I ask is that I have two functions that take an enum
> argument. The first takes one of three
On 01/09/2017 08:43 PM, Steven D'Aprano wrote:
Is it silly to create an enumeration with only a single member? That is, a
singleton enum?
from enum import Enum
class Unique(Enum):
FOO = auto()
The reason I ask is that I have two functions that take an enum argument. The
first takes one
Is it silly to create an enumeration with only a single member? That is, a
singleton enum?
from enum import Enum
class Unique(Enum):
FOO = auto()
The reason I ask is that I have two functions that take an enum argument. The
first takes one of three enums:
class MarxBros(Enum):
GROUCH