diff --git a/pyopencl/__init__.py b/pyopencl/__init__.py
index 0e7412b17d4e3bf6f4b731a90a9782448350c5a5..787369ace9a3ac8503c8eeabac98fe26971b8cbc 100644
--- a/pyopencl/__init__.py
+++ b/pyopencl/__init__.py
@@ -642,7 +642,7 @@ def _add_functionality():
                 PythonCodeGenerator,
                 Indentation)
 
-        arg_names = ["arg%d" % i for i in xrange(num_passed_args)]
+        arg_names = ["arg%d" % i for i in range(num_passed_args)]
 
         # {{{ wrap in error handler