summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <baker.dylan.c@gmail.com>2016-03-29 10:19:27 -0700
committerDylan Baker <baker.dylan.c@gmail.com>2016-03-31 16:03:57 -0700
commit730f5796893c4f969703e8ce23f944620ca33d8e (patch)
treeebbb6316339f66fb120ea5dd513e25b05052cfd7
parent8259de945a5c4a027c0ef8e451e5463ce6eedd4e (diff)
glapi: gl_XML.py: use python's iter() function rather than calling __iter__
Python has what are often referred to as "magic methods". __iter__, __str__, __add__, and countless more. All of these methods exist to be called by another function or by an operator. The __add__ method implements the + operator, for example. There are times to call the magic methods directly, but usually that's in cases where an implementation needs to call it's parent's method. Instead it's best to use the function or operator that the magic method implements. This makes the code cleaner, more idiomatic, and just a bit nicer to read. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
-rw-r--r--src/mapi/glapi/gen/gl_XML.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mapi/glapi/gen/gl_XML.py b/src/mapi/glapi/gen/gl_XML.py
index d273ff0074..42fcc41dfc 100644
--- a/src/mapi/glapi/gen/gl_XML.py
+++ b/src/mapi/glapi/gen/gl_XML.py
@@ -734,9 +734,9 @@ class gl_function(gl_item):
def parameterIterator(self, name=None):
if name is not None:
- return self.entry_point_parameters[name].__iter__()
+ return iter(self.entry_point_parameters[name])
else:
- return self.parameters.__iter__()
+ return iter(self.parameters)
def get_parameter_string(self, entrypoint=None):
if entrypoint:
@@ -935,7 +935,7 @@ class gl_api(object):
for name in names:
functions.append(lists[func_cat_type][key][name])
- return functions.__iter__()
+ return iter(functions)
def functionIterateByOffset(self):
max_offset = -1
@@ -953,7 +953,7 @@ class gl_api(object):
if temp[i]:
list.append(temp[i])
- return list.__iter__()
+ return iter(list)
def functionIterateAll(self):
return self.functions_by_name.itervalues()
@@ -966,7 +966,7 @@ class gl_api(object):
for enum in keys:
list.append(self.enums_by_name[enum])
- return list.__iter__()
+ return iter(list)
def categoryIterate(self):
"""Iterate over categories.
@@ -983,7 +983,7 @@ class gl_api(object):
for key in keys:
list.append(self.categories[cat_type][key])
- return list.__iter__()
+ return iter(list)
def get_category_for_name(self, name):
if name in self.category_dict: