Make the first argument of update() methods be an optional positional argument
authorZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 06:42:01 +0000 (06:42 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 06:42:01 +0000 (06:42 -0000)
instead of a keyword argument. (trunk r12755)

svn path=/main/branches/2.1.6/; revision=13003

pym/portage/cache/mappings.py

index 1117b855b288487ef7ac8c036f7489cd367051ad..77923b46230a49bfcb10aaf659458d74216536f9 100644 (file)
@@ -111,7 +111,14 @@ class MutableMapping(Mapping):
                del self[k]
                return (k, v)
 
-       def update(self, other=None, **kwargs):
+       def update(self, *args, **kwargs):
+               if len(args) > 1:
+                       raise TypeError(
+                               "expected at most 1 positional argument, got " + \
+                               repr(len(args)))
+               other = None
+               if args:
+                       other = args[0]
                if other is None:
                        pass
                elif hasattr(other, 'iteritems'):
@@ -369,7 +376,14 @@ def slot_dict_class(keys, prefix="_val_"):
                                        self[key] = default
                                return default
 
-                       def update(self, other=None, **kwargs):
+                       def update(self, *args, **kwargs):
+                               if len(args) > 1:
+                                       raise TypeError(
+                                               "expected at most 1 positional argument, got " + \
+                                               repr(len(args)))
+                               other = None
+                               if args:
+                                       other = args[0]
                                if other is None:
                                        pass
                                elif hasattr(other, 'iteritems'):