[pypy-svn] r15816 - pypy/dist/pypy/objspace/std

ale at codespeak.net ale at codespeak.net
Tue Aug 9 16:16:56 CEST 2005


Author: ale
Date: Tue Aug  9 16:16:56 2005
New Revision: 15816

Modified:
   pypy/dist/pypy/objspace/std/dicttype.py
Log:
Adding __reversed__ for dicts. It raises a TypeError. 



Modified: pypy/dist/pypy/objspace/std/dicttype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/dicttype.py	(original)
+++ pypy/dist/pypy/objspace/std/dicttype.py	Tue Aug  9 16:16:56 2005
@@ -1,5 +1,6 @@
 from pypy.objspace.std.stdtypedef import *
 from pypy.objspace.std.register_all import register_all
+from pypy.interpreter.error import OperationError
 
 dict_copy       = MultiMethod('copy',          1)
 dict_items      = MultiMethod('items',         1)
@@ -15,6 +16,10 @@
 dict_iteritems  = MultiMethod('iteritems',     1)
 dict_iterkeys   = MultiMethod('iterkeys',      1)
 dict_itervalues = MultiMethod('itervalues',    1)
+dict_reversed   = MultiMethod('__reversed__',      1)
+
+def dict_reversed__ANY(space, w_dict):
+    raise OperationError(space.wrap(TypeError),space.wrap('argument to reversed() must be a sequence'))
 #dict_fromkeys   = MultiMethod('fromkeys',      2, varargs=True)
 # This can return when multimethods have been fixed
 #dict_str        = StdObjSpace.str



More information about the Pypy-commit mailing list