[Python-checkins] CVS: python/dist/src/Misc NEWS,1.100,1.101
Guido van Rossum
gvanrossum@users.sourceforge.net
Thu, 18 Jan 2001 06:28:11 -0800
Update of /cvsroot/python/python/dist/src/Misc
In directory usw-pr-cvs1:/tmp/cvs-serv25112
Modified Files:
NEWS
Log Message:
- Add note about complex numbers.
- Changed description of rich comparisons to emphasize that < and >
(etc.) are each other's reflection. Also use this word in the note
about the demise of __rcmp__.
Index: NEWS
===================================================================
RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v
retrieving revision 1.100
retrieving revision 1.101
diff -C2 -r1.100 -r1.101
*** NEWS 2001/01/17 17:09:53 1.100
--- NEWS 2001/01/18 14:28:08 1.101
***************
*** 30,40 ****
Classes can overload individual comparison operators by defining one
or more of the methods__lt__, __le__, __eq__, __ne__, __gt__,
! __ge__. There are no explicit "reversed argument" versions of
! these; instead, __lt__ and __gt__ are each other's reverse, likewise
! for__le__ and __ge__; __eq__ and __ne__ are their own reverse
! (similar at the C level). No other implications are made; in
! particular, Python does not assume that == is the inverse of !=, or
! that < is the inverse of >=. This makes it possible to define types
! with partial orderings.
Classes or types that want to implement (in)equality tests but not
--- 30,40 ----
Classes can overload individual comparison operators by defining one
or more of the methods__lt__, __le__, __eq__, __ne__, __gt__,
! __ge__. There are no explicit "reflected argument" versions of
! these; instead, __lt__ and __gt__ are each other's reflection,
! likewise for__le__ and __ge__; __eq__ and __ne__ are their own
! reflection (similar at the C level). No other implications are
! made; in particular, Python does not assume that == is the Boolean
! inverse of !=, or that < is the Boolean inverse of >=. This makes
! it possible to define types with partial orderings.
Classes or types that want to implement (in)equality tests but not
***************
*** 42,46 ****
and !=, and raise an error for the ordering operators.
! It is possible to define types whose comparison results are not
Boolean; e.g. a matrix type might want to return a matrix of bits
for A < B, giving elementwise comparisons. Such types should ensure
--- 42,46 ----
and !=, and raise an error for the ordering operators.
! It is possible to define types whose rich comparison results are not
Boolean; e.g. a matrix type might want to return a matrix of bits
for A < B, giving elementwise comparisons. Such types should ensure
***************
*** 49,52 ****
--- 49,59 ----
at the C level) to always raise an exception.
+ - Complex numbers use rich comparisons to define == and != but raise
+ an exception for <, <=, > and >=. Unfortunately, this also means
+ that cmp() of two complex numbers raises an exception when the two
+ numbers differ. Since it is not mathematically meaningful to compare
+ complex numbers except for equality, I hope that this doesn't break
+ too much code.
+
- Functions and methods now support getting and setting arbitrarily
named attributes (PEP 232). Functions have a new __dict__
***************
*** 114,118 ****
is considered an improvement. Also note that __rcmp__ is no longer
supported -- instead of calling __rcmp__, __cmp__ is called with
! reversed arguments.
- In connection with the coercion changes, a new built-in singleton
--- 121,125 ----
is considered an improvement. Also note that __rcmp__ is no longer
supported -- instead of calling __rcmp__, __cmp__ is called with
! reflected arguments.
- In connection with the coercion changes, a new built-in singleton