[Patches] [ python-Patches-487455 ] make types.StringTypes a tuple

noreply@sourceforge.net noreply@sourceforge.net
Fri, 30 Nov 2001 02:57:52 -0800


Patches item #487455, was opened at 2001-11-30 02:57
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=487455&group_id=5470

Category: Library (Lib)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Markus F.X.J. Oberhumer (mfx)
Assigned to: Nobody/Anonymous (nobody)
Summary: make types.StringTypes a tuple

Initial Comment:
The small patch below makes types.StringTypes a tuple,
so that you can use "isinstance(var, StringTypes)".

As StringTypes was introduced in the 2.2 development
cycle there should not be any compatibility concerns.

Markus


--- Lib/types.py        Tue Oct 30 06:19:53 2001
+++ Lib/types.py.new    Fri Nov 30 11:47:42 2001
@@ -26,9 +26,9 @@
 StringType = str
 try:
     UnicodeType = unicode
-    StringTypes = [StringType, UnicodeType]
+    StringTypes = (StringType, UnicodeType)
 except NameError:
-    StringTypes = [StringType]
+    StringTypes = (StringType,)

 BufferType = type(buffer(''))



----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=487455&group_id=5470