[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50197] trunk/blender/release/scripts/ modules/rna_xml.py: use set's when checking against multiple types.

Campbell Barton ideasman42 at gmail.com
Sat Aug 25 13:54:58 CEST 2012


Revision: 50197
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50197
Author:   campbellbarton
Date:     2012-08-25 11:54:58 +0000 (Sat, 25 Aug 2012)
Log Message:
-----------
use set's when checking against multiple types.

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/rna_xml.py

Modified: trunk/blender/release/scripts/modules/rna_xml.py
===================================================================
--- trunk/blender/release/scripts/modules/rna_xml.py	2012-08-24 23:22:34 UTC (rev 50196)
+++ trunk/blender/release/scripts/modules/rna_xml.py	2012-08-25 11:54:58 UTC (rev 50197)
@@ -99,11 +99,11 @@
             subvalue = getattr(value, prop)
             subvalue_type = type(subvalue)
 
-            if subvalue_type in (int, bool, float):
+            if subvalue_type in {int, bool, float}:
                 node_attrs.append("%s=\"%s\"" % (prop, number_to_str(subvalue, subvalue_type)))
             elif subvalue_type is str:
                 node_attrs.append("%s=%s" % (prop, quoteattr(subvalue)))
-            elif subvalue_type == set:
+            elif subvalue_type is set:
                 node_attrs.append("%s=%s" % (prop, quoteattr("{" + ",".join(list(subvalue)) + "}")))
             elif subvalue is None:
                 node_attrs.append("%s=\"NONE\"" % prop)
@@ -137,7 +137,7 @@
                             # default
                             def str_recursive(s):
                                 subsubvalue_type = type(s)
-                                if subsubvalue_type in (int, float, bool):
+                                if subsubvalue_type in {int, float, bool}:
                                     return number_to_str(s, subsubvalue_type)
                                 else:
                                     return " ".join([str_recursive(si) for si in s])




More information about the Bf-blender-cvs mailing list