On 06/29/2018 05:51 PM, Steven D'Aprano wrote:
So not especially complimentary (sorry Ethan, but that was my first
impression) but not *necessarily* a bad thing either.
No worries! :)
The Jargon File adjective that comes closest is probably gnarly:
Wow, I haven't heard that word in a
On Fri, 29 Jun 2018 10:36:45 -0700, Ethan Furman wrote:
>> What makes them enums? Under what circumstances would you be comparing
>> something to MartinLutherKingJr (Day) without caring about a *specific*
>> Martin Luther King Jr Day?
>
> Enums are also useful when the underlying value is
On Sat, Jun 30, 2018 at 10:51 AM, Steven D'Aprano
wrote:
> ["Baroque"] should not mean "weird or bizarre", although I've seen a couple of
> lesser-quality dictionaries give that as a meaning. Which is itself weird
> and bizarre :-)
>
I guess those dictionaries are baroque. Or maybe just broke.
On Sat, 30 Jun 2018 09:02:37 +1000, Cameron Simpson wrote:
> On 29Jun2018 10:36, Ethan Furman wrote:
>>On 06/28/2018 10:52 PM, Steven D'Aprano wrote:
>>>It isn't clear to me why FederalHoliday is an Enum, especially as the
>>>API seems extremely baraque.
>>
>>Huh. I had to look that word up,
Cameron Simpson wrote:
It tends to mean "weird", but perhaps a more nuanced phrasing might be
unusual and strange, and usually connotes some degree of over complication.
When used in a derogatory way it means "excessively elaborate".
The Baroque period was characterised by extremely ornate
Ethan Furman wrote:
They are the list of dates in which US banks are closed for electronic
business (funds transfers and things).
That sems like something that would be better specified in
a configuration file than hard-wired into the code, in case
the rules change.
--
Greg
--
On 06/29/18 16:02, Cameron Simpson wrote:
On 29Jun2018 10:36, Ethan Furman wrote:
On 06/28/2018 10:52 PM, Steven D'Aprano wrote:
On Thu, 28 Jun 2018 18:33:31 -0700, Ethan Furman wrote:
Perhaps I am using Enum incorrectly, but here is my FederalHoliday
Enum.
Note that date(),
On 29Jun2018 10:36, Ethan Furman wrote:
On 06/28/2018 10:52 PM, Steven D'Aprano wrote:
On Thu, 28 Jun 2018 18:33:31 -0700, Ethan Furman wrote:
Perhaps I am using Enum incorrectly, but here is my FederalHoliday Enum.
Note that date(), next_business_day, and year() are all callables. The
On 06/28/2018 10:52 PM, Steven D'Aprano wrote:
On Thu, 28 Jun 2018 18:33:31 -0700, Ethan Furman wrote:
Perhaps I am using Enum incorrectly, but here is my FederalHoliday Enum.
Note that date(), next_business_day, and year() are all callables. The
AutoEnum parent assigns values from 1 to n
On 29/06/2018 09:01, Ian Kelly wrote:
On Thu, Jun 28, 2018 at 10:06 PM Ben Finney wrote:
@total_ordering
class ChessPiece(Enum):
PAWN = 1, 'P'
KNIGHT = 2, 'N'
BISHOP = 3, 'B'
ROOK = 4, 'R'
# ...
@property
def label(self):
return self.value[1]
On Thu, Jun 28, 2018 at 10:06 PM Ben Finney wrote:
>
> Ethan Furman writes:
>
> > On 06/28/2018 05:58 PM, Ben Finney wrote:
> >
> > > So I remain dumbfounded as to why anyone would want a class to *both* be
> > > an enumerated type, *and* have callable attributes in its API.
> >
> > Perhaps I am
On Thu, Jun 28, 2018 at 7:01 PM Ben Finney wrote:
>
> Ian Kelly writes:
>
> > On Thu, Jun 28, 2018 at 4:38 AM Ben Finney
> > wrote:
> > >
> > > Ethan Furman writes:
> > >
> > > Specifically, I can't make sense of why someone would want to have a
> > > class that is simultaneously behaving as
On Thu, 28 Jun 2018 18:33:31 -0700, Ethan Furman wrote:
> On 06/28/2018 05:58 PM, Ben Finney wrote:
>
>> So I remain dumbfounded as to why anyone would want a class to *both*
>> be an enumerated type, *and* have callable attributes in its API.
>
> Perhaps I am using Enum incorrectly, but here
Ethan Furman writes:
> On 06/28/2018 05:58 PM, Ben Finney wrote:
>
> > So I remain dumbfounded as to why anyone would want a class to *both* be
> > an enumerated type, *and* have callable attributes in its API.
>
> Perhaps I am using Enum incorrectly, but here is my FederalHoliday
> Enum. […]
On 06/28/2018 05:58 PM, Ben Finney wrote:
So I remain dumbfounded as to why anyone would want a class to *both* be
an enumerated type, *and* have callable attributes in its API.
Perhaps I am using Enum incorrectly, but here is my FederalHoliday Enum. Note that date(), next_business_day, and
On Thu, 28 Jun 2018 20:34:58 +1000, Ben Finney wrote:
> Ethan Furman writes:
>
>> Consider the following Enum definition:
>>
>> class Color(Enum):
>> RED = 1
>> GREEN = 2
>> BLUE = 3
>> @property
>> def lower(self):
>> return self.name.lower()
>>
On Thu, 28 Jun 2018 08:36:47 -0700, Ethan Furman wrote:
>>> Answer:
>>>
>>> - RED, GREEN, and BLUE are members
>>> - lower and spam() are not
>>> - SomeClass /is/ a member (but not its instances)
>>
>> Is that by accident or by design?
>
> By design. It is entirely possible to want
Ian Kelly writes:
> On Thu, Jun 28, 2018 at 4:38 AM Ben Finney wrote:
> >
> > Ethan Furman writes:
> >
> > Specifically, I can't make sense of why someone would want to have a
> > class that is simultaneously behaving as an enumerated type, *and*
> > has an API of custom callable attributes.
>
On Thu, Jun 28, 2018 at 4:38 AM Ben Finney wrote:
>
> Ethan Furman writes:
>
> > Consider the following Enum definition:
> >
> > class Color(Enum):
> > RED = 1
> > GREEN = 2
> > BLUE = 3
> > @property
> > def lower(self):
> > return self.name.lower()
> >
to make an Enum of Enums, and the nested Enum should not
itself be an enum member. Since the counter-example already works I
haven't seen any requests for it. ;)
So I'm asking the community: What real-world examples can you offer for
either behavior? Cases where nested classes should be enum
Ethan Furman writes:
> Consider the following Enum definition:
>
> class Color(Enum):
> RED = 1
> GREEN = 2
> BLUE = 3
> @property
> def lower(self):
> return self.name.lower()
> def spam(self):
> return "I like %s eggs and spam!" %
an Enum is when
> folks want to make an Enum of Enums, and the nested Enum should not
> itself be an enum member. Since the counter-example already works I
> haven't seen any requests for it. ;)
>
> So I'm asking the community: What real-world examples can you offer for
&
be an enum member. Since the counter-example already works I haven't seen any requests
for it. ;)
So I'm asking the community: What real-world examples can you offer for either behavior? Cases where nested classes
should be enum members, and cases where nested classes should not be members
23 matches
Mail list logo