[Python-checkins] r74628 - python/branches/py3k/Lib/pstats.py

georg.brandl python-checkins at python.org
Wed Sep 2 22:33:30 CEST 2009


Author: georg.brandl
Date: Wed Sep  2 22:33:30 2009
New Revision: 74628

Log:
Use true kwonly arg instead of **kwds hackaround.

Modified:
   python/branches/py3k/Lib/pstats.py

Modified: python/branches/py3k/Lib/pstats.py
==============================================================================
--- python/branches/py3k/Lib/pstats.py	(original)
+++ python/branches/py3k/Lib/pstats.py	Wed Sep  2 22:33:30 2009
@@ -70,20 +70,8 @@
                             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:


More information about the Python-checkins mailing list