]> granicus.if.org Git - python/commit
- Another big step in the right direction. All the overridable
authorGuido van Rossum <guido@python.org>
Wed, 15 Aug 2001 23:57:02 +0000 (23:57 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 15 Aug 2001 23:57:02 +0000 (23:57 +0000)
commitb8f636641fd59656aeb38825cec38e4f208e7500
tree628cca41710792a5ebc623827740d94d4c179b99
parentba634b2ec3977cdc61ab097bd455d3ab0f925bf1
- Another big step in the right direction.  All the overridable
  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.)
Objects/typeobject.c