• Guido van Rossum's avatar
    Ouch. The test suite *really* needs work!!!!! There were several · 9f87293b
    Guido van Rossum yazdı
    superficial errors and one deep one that aren't currently caught.  I'm
    headed for bed after this checkin.
    
    - Fixed several typos introduced by Raymond Hettinger (through
      cut-n-paste from my template): it's _as_temporarily_immutable, not
      _as_temporary_immutable, and moreover when the element is added, we
      should use _as_immutable.
    
    - Made the seq argument to ImmutableSet.__init__ optional, so we can
      write ImmutableSet() to create an immutable empty set.
    
    - Rename the seq argument to Set and ImmutableSet to iterable.
    
    - Add a Set.__hash__ method that raises a TypeError.  We inherit a
      default __hash__ implementation from object, and we don't want that.
      We can then catch this in update(), so that
      e.g. s.update([Set([1])]) will transform the Set([1]) to
      ImmutableSet([1]).
    
    - Added the dance to catch TypeError and try _as_immutable in the
      constructors too (by calling _update()).  This is needed so that
      Set([Set([1])]) is correctly interpreted as
      Set([ImmutableSet([1])]).  (I was puzzled by a side effect of this
      and the inherited __hash__ when comparing two sets of sets while
      testing different powerset implementations: the Set element passed
      to a Set constructor wasn't transformed to an ImmutableSet, and then
      the dictionary didn't believe the Set found in one dict it was the
      same as ImmutableSet in the other, because the hashes were
      different.)
    
    - Refactored Set.update() and both __init__() methods; moved the body
      of update() into BaseSet as _update(), and call this from __init__()
      and update().
    
    - Changed the NotImplementedError in BaseSet.__init__ to TypeError,
      both for consistency with basestring() and because we have to use
      TypeError when denying Set.__hash__.  Together those provide
      sufficient evidence that an unimplemented method needs to raise
      TypeError.
    9f87293b
Adı
Son kayıt (commit)
Son güncelleme
Demo Loading commit data...
Doc Loading commit data...
Grammar Loading commit data...
Include Loading commit data...
Lib Loading commit data...
Mac Loading commit data...
Misc Loading commit data...
Modules Loading commit data...
Objects Loading commit data...
PC Loading commit data...
PCbuild Loading commit data...
Parser Loading commit data...
Python Loading commit data...
RISCOS Loading commit data...
Tools Loading commit data...
.cvsignore Loading commit data...
.hgtags Loading commit data...
LICENSE Loading commit data...
Makefile.pre.in Loading commit data...
README Loading commit data...
configure Loading commit data...
configure.in Loading commit data...
install-sh Loading commit data...
pyconfig.h.in Loading commit data...
setup.py Loading commit data...