• Guido van Rossum's avatar
    - Another big step in the right direction. All the overridable · 24bc2ca2
    Guido van Rossum authored
      operators for which a default implementation exist now work, both in
      dynamic classes and in static classes, overridden or not.  This
      affects __repr__, __str__, __hash__, __contains__, __nonzero__,
      __cmp__, and the rich comparisons (__lt__ etc.).  For dynamic
      classes, this meant copying a lot of code from classobject!  (XXX
      There are still some holes, because the comparison code in object.c
      uses PyInstance_Check(), meaning new-style classes don't get the
      same dispensation.  This needs more thinking.)
    
    - Add object.__hash__, object.__repr__, object.__str__.  The __str__
      dispatcher now calls the __repr__ dispatcher, as it should.
    
    - For static classes, the tp_compare, tp_richcompare and tp_hash slots
      are now inherited together, or not at all.  (XXX I fear there are
      still some situations where you can inherit __hash__ when you
      shouldn't, but mostly it's OK now, and I think there's no way we can
      get that 100% right.)
    24bc2ca2
typeobject.c 69.3 KB