On 9/11/2017 6:28 PM, Guido van Rossum wrote:
Oddly I don't like the enum (flag names get too long that way), but I do agree with everything else Barry said (it should be a trivalue flag and please don't name it cmp).

So if we don't do enums, I think the choices are ints, strs, or maybe True/False/None. Do you have a preference here?

If int or str, I assume we'd want module-level constants.

I like the name compare=, and 3 values makes sense: None, Equality, Ordered.

Eric.


On Mon, Sep 11, 2017 at 3:16 PM, Ethan Furman <et...@stoneleaf.us <mailto:et...@stoneleaf.us>> wrote:

    On 09/11/2017 03:00 PM, Barry Warsaw wrote:

        On Sep 10, 2017, at 20:08, Nathaniel Smith wrote:


            I've sometimes wished that attrs let me control whether it
            generated equality methods (eq/ne/hash) separately from
            ordering methods (lt/gt/...). Maybe the cmp= argument should
            take an enum with options none/equality-only/full?


        I have had use cases where I needed equality comparisons but not
        ordered comparisons, so I’m in favor of the option to split
        them.  (atm, I can’t bring up a specific case, but it’s not
        uncommon.)

        Given that you only want to support the three states that
        Nathaniel describes, I think an enum makes the most sense, and
        it certainly would read well.  I.e. there’s no sense in
        supporting the ordered comparisons and not equality, so that’s
        not a state that needs to be represented.

        I’d make one other suggestion here: please let’s not call the
        keyword `cmp`.  That’s reminiscent of Python 2’s `cmp` built-in,
        which of course doesn’t exist in Python 3.  Using `cmp` is just
        an unnecessarily obfuscating abbreviation.  I’d suggest just
        `compare` with an enum like so:

        enum Compare(enum.Enum):
              none = 1
              unordered = 2
              ordered = 3


    I like the enum idea (suprise! ;) but I would suggest "equal" or
    "equivalent" instead of "unordered"; better to say what they are
    rather than what they are not.

    --
    ~Ethan~

    _______________________________________________
    Python-Dev mailing list
    Python-Dev@python.org <mailto:Python-Dev@python.org>
    https://mail.python.org/mailman/listinfo/python-dev
    <https://mail.python.org/mailman/listinfo/python-dev>
    Unsubscribe:
    https://mail.python.org/mailman/options/python-dev/guido%40python.org 
<https://mail.python.org/mailman/options/python-dev/guido%40python.org>




--
--Guido van Rossum (python.org/~guido <http://python.org/%7Eguido>)


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/eric%2Ba-python-dev%40trueblade.com


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to