From: Jeremy Stanley Date: Wed, 12 Dec 2012 20:58:27 +0000 (+0000) Subject: Use int type instead of long X-Git-Tag: 0.0.1~271 X-Git-Url: https://mudpy.org/gitweb?p=mudpy.git;a=commitdiff_plain;h=1ea09b81fed5028954588048880577220964d3a3 Use int type instead of long * lib/mudpy/misc.py: Use int type instead of long, since Py3K will no longer have a different representation for the latter. --- diff --git a/lib/mudpy/misc.py b/lib/mudpy/misc.py index d67ff37..3193e11 100644 --- a/lib/mudpy/misc.py +++ b/lib/mudpy/misc.py @@ -142,7 +142,7 @@ class Element: return default def getint(self, facet, default=None): - """Return values as int/long type.""" + """Return values as int type.""" if default is None: default = 0 if self.origin.data.has_option(self.key, facet): @@ -192,18 +192,17 @@ class Element: def set(self, facet, value): """Set values.""" if not self.has_facet(facet) or not self.get(facet) == value: - if type(value) is long or repr(type(value)) == "": + # TODO: remove this check after the switch to py3k + if repr(type(value)) == "": value = str(value) - elif not type(value) is str: + if not type(value) is str: value = repr(value) self.origin.data.set(self.key, facet, value) self.origin.modified = True def append(self, facet, value): - """Append value tp a list.""" - if type(value) is long: - value = str(value) - elif not type(value) is str: + """Append value to a list.""" + if not type(value) is str: value = repr(value) newlist = self.getlist(facet) newlist.append(value)