[Python-checkins] python/dist/src/Lib sets.py,1.32,1.33

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Thu, 07 Nov 2002 21:26:54 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv17545/Lib

Modified Files:
	sets.py 
Log Message:
_update():  Commented the new obscurity.  Materialized into a tuple
instead of into a list for a bit of speed/space savings.  Reopened the
bug report too (628246), as I'm unclear on why we don't sort out the
cause of the TypeError instead.


Index: sets.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** sets.py	8 Nov 2002 05:03:21 -0000	1.32
--- sets.py	8 Nov 2002 05:26:52 -0000	1.33
***************
*** 320,327 ****
              return
  
!         value = True
          if type(iterable) not in (list, tuple, dict, file, xrange, str):
!             iterable = list(iterable)
          it = iter(iterable)
          while True:
              try:
--- 320,333 ----
              return
  
!         # If the mere process of iterating may raise TypeError, materialize
!         # the iterable into a tuple first.  Then the TypeError will get
!         # raised here and propagated back to the caller.  Once we get into
!         # the loop following, TypeError is assumed to mean that element
!         # can't be used as a dict key.
          if type(iterable) not in (list, tuple, dict, file, xrange, str):
!             iterable = tuple(iterable)
! 
          it = iter(iterable)
+         value = True
          while True:
              try: