On 04/12/2013 08:02 AM, Barry Warsaw wrote: > On Apr 12, 2013, at 03:31 PM, Dirkjan Ochtman wrote: > >> On Fri, Apr 12, 2013 at 2:55 PM, Eli Bendersky <eliben at gmail.com> wrote: >>> Ordered comparisons between enumeration values are *not* supported. Enums >>> are >>> not integers (but see `IntEnum`_ below):: >>> >>> >>> Colors.red < Colors.blue >>> Traceback (most recent call last): >>> ... >>> NotImplementedError >>> >>> Colors.red <= Colors.blue >>> Traceback (most recent call last): >>> ... >>> NotImplementedError >>> >>> Colors.blue > Colors.green >>> Traceback (most recent call last): >>> ... >>> NotImplementedError >>> >>> Colors.blue >= Colors.green >>> Traceback (most recent call last): >>> ... >>> NotImplementedError >> >> I like much of this PEP, but the exception type for this case seems >> odd to me. Wouldn't a TypeError be more appropriate here? >> >> Somewhat like this: >> >>>>> 'a' - 'b' >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> TypeError: unsupported operand type(s) for -: 'str' and 'str' > > Interesting. I'm having a hard time articulating why, but NotImplementedError > just feels more right to me in this case. NotImplemented makes it seem like we could implement it in a subclass -- is this true? Also, for a more direct comparison: --> 'a' < 1 Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unorderable types: str() < int() I would think this is the more appropriate exception and text to use. -- ~Ethan~
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4