[Python-checkins] python/nondist/sandbox/sets set.py,1.6,1.7

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Sat, 17 Aug 2002 05:20:53 -0700


Update of /cvsroot/python/python/nondist/sandbox/sets
In directory usw-pr-cvs1:/tmp/cvs-serv23432

Modified Files:
	set.py 
Log Message:
Default sort_repr to True, per Tim's recommendation.


Index: set.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/sets/set.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** set.py	16 Aug 2002 22:23:34 -0000	1.6
--- set.py	17 Aug 2002 12:20:50 -0000	1.7
***************
*** 52,61 ****
      # Constructor
  
!     def __init__(self, seq=None, sort_repr=False):
          """Construct a set, optionally initializing it from a sequence.
  
!         If the optional keyword argument sort_repr is True, the set's
!         elements are displayed in sorted order.  This slows down
!         conversion to string, but simplifies comparison during testing.
          """
          self._sort_repr = sort_repr
--- 52,64 ----
      # Constructor
  
!     def __init__(self, seq=None, sort_repr=True):
          """Construct a set, optionally initializing it from a sequence.
  
!         Unless the optional keyword argument sort_repr is False, the
!         set's elements are displayed in sorted order.  This slows down
!         string conversions, but is generally more user-friendly.  The
!         option to turn off this behavior is provided so that you can
!         create sets whose elements are not ordered; for example,
!         complex numbers.
          """
          self._sort_repr = sort_repr
***************
*** 279,288 ****
      _hashcode = None
  
!     def __init__(self, seq, sort_repr=0):
          """Construct an immutable set from a sequence.
  
!         If the optional keyword argument sort_repr is True, the set's
!         elements are displayed in sorted order.  This slows down
!         conversion to string, but simplifies comparison during testing.
          """
          # Override the constructor to make 'seq' a required argument
--- 282,294 ----
      _hashcode = None
  
!     def __init__(self, seq, sort_repr=True):
          """Construct an immutable set from a sequence.
  
!         Unless the optional keyword argument sort_repr is False, the
!         set's elements are displayed in sorted order.  This slows down
!         string conversions, but is generally more user-friendly.  The
!         option to turn off this behavior is provided so that you can
!         create sets whose elements are not ordered; for example,
!         complex numbers.
          """
          # Override the constructor to make 'seq' a required argument
***************
*** 445,461 ****
  
      # Unit set
!     green = Set((0,), 1)
      assert `green` == "Set([0])", "Unit set: %s" % `green`
  
      # 3-element set
!     blue = Set([0, 1, 2], 1)
      assert `blue` == "Set([0, 1, 2])", "3-element set: %s" % `blue`
  
      # 2-element set with other values
!     black = Set([0, 5], 1)
      assert `black` == "Set([0, 5])", "2-element set: %s" % `black`
  
      # All elements from all sets
!     white = Set([0, 1, 2, 5], 1)
      assert `white` == "Set([0, 1, 2, 5])", "4-element set: %s" % `white`
  
--- 451,467 ----
  
      # Unit set
!     green = Set((0,))
      assert `green` == "Set([0])", "Unit set: %s" % `green`
  
      # 3-element set
!     blue = Set([0, 1, 2])
      assert `blue` == "Set([0, 1, 2])", "3-element set: %s" % `blue`
  
      # 2-element set with other values
!     black = Set([0, 5])
      assert `black` == "Set([0, 5])", "2-element set: %s" % `black`
  
      # All elements from all sets
!     white = Set([0, 1, 2, 5])
      assert `white` == "Set([0, 1, 2, 5])", "4-element set: %s" % `white`