]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Use true kwonly arg instead of **kwds hackaround.
authorGeorg Brandl <georg@python.org>
Wed, 2 Sep 2009 20:33:30 +0000 (20:33 +0000)
committerGeorg Brandl <georg@python.org>
Wed, 2 Sep 2009 20:33:30 +0000 (20:33 +0000)
Lib/pstats.py

index 3e6e99476c9f4d0ce47d39ae1ad5b8511db775ff..fe7f225cc1c6f6ebc180609c29b907c3b660d8c2 100644 (file)
@@ -70,20 +70,8 @@ class Stats:
                             print_stats(5).print_callers(5)
     """
 
-    def __init__(self, *args, **kwds):
-        # I can't figure out how to explictly specify a stream keyword arg
-        # with *args:
-        #   def __init__(self, *args, stream=sys.stdout): ...
-        # so I use **kwds and sqauwk if something unexpected is passed in.
-        self.stream = sys.stdout
-        if "stream" in kwds:
-            self.stream = kwds["stream"]
-            del kwds["stream"]
-        if kwds:
-            keys = kwds.keys()
-            keys.sort()
-            extras = ", ".join(["%s=%s" % (k, kwds[k]) for k in keys])
-            raise ValueError("unrecognized keyword args: %s" % extras)
+    def __init__(self, *args, stream=None):
+        self.stream = stream or sys.stdout
         if not len(args):
             arg = None
         else: