1. 18 Jan, 2001 5 commits
    • Tim Peters's avatar
    • Guido van Rossum's avatar
      Use rich comparisons to fulfill an old wish: complex numbers now raise · 1dc1a5fd
      Guido van Rossum authored
      exceptions when compared using <, <=, > or >=.
      
      NOTE: This is a tentative change: this means that cmp() involving
      complex numbers will raise an exception when the numbers differ, and
      that in turn means that e.g. dictionaries and certain other compounds
      (e.g. UserLists) containing complex numbers can't be compared either.
      So we'll have to decide whether this is acceptable.  The alpha test
      cycle is a good time to keep an eye on this!
      1dc1a5fd
    • Guido van Rossum's avatar
      Same treatment as listobject.c: · ce664547
      Guido van Rossum authored
      - In count(), remove(), index(): call RichCompare(Py_EQ).
      
      - Get rid of array_compare(), in favor of new array_richcompare() (a
        near clone of list_compare()).
      
      - Aligned items in array_methods initializer and comments for type
        struct initializer.
      
      - Folded a few long lines.
      ce664547
    • Guido van Rossum's avatar
      Rich comparisons: · 716c5a68
      Guido van Rossum authored
      - Use PyObject_RichCompareBool() when comparing keys; this makes the
        error handling cleaner.
      
      - There were two implementations for dictionary comparison, an old one
        (#ifdef'ed out) and a new one.  Got rid of the old one, which was
        abandoned years ago.
      
      - In the characterize() function, part of dictionary comparison, use
        PyObject_RichCompareBool() to compare keys and values instead.  But
        continue to use PyObject_Compare() for comparing the final
        (deciding) elements.
      
      - Align the comments in the type struct initializer.
      
      Note: I don't implement rich comparison for dictionaries -- there
      doesn't seem to be much to be gained.  (The existing comparison
      already decides that shorter dicts are always smaller than longer
      dicts.)
      716c5a68
    • Guido van Rossum's avatar
      Same treatment as listobject.c: · 242d1ca0
      Guido van Rossum authored
      - tuplecontains(): call RichCompare(Py_EQ).
      
      - Get rid of tuplecompare(), in favor of new tuplerichcompare() (a
        clone of list_compare()).
      
      - Aligned the comments for large struct initializers.
      242d1ca0
  2. 17 Jan, 2001 35 commits