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

noreply@sourceforge.net noreply@sourceforge.net
Sun, 02 Dec 2001 04:08:38 -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: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Markus F.X.J. Oberhumer (mfx)
Assigned to: Martin v. Löwis (loewis)
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(''))



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

>Comment By: Martin v. Löwis (loewis)
Date: 2001-12-02 04:08

Message:
Logged In: YES 
user_id=21627

Thanks for the patch. Committed as types.py 1.25

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

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