[Python-Dev] removing nested tuple function parameters

Steven Bethard steven.bethard at gmail.com
Sun Sep 18 04:15:09 CEST 2005


Brett Cannon wrote:
> Is anyone truly attached to nested tuple function parameters; ``def
> fxn((a,b)): print a,b``?

I find 54 instances in my Python installation.

>grep -r "def.*([^=]*([^)]*,[^)]*).*):" *
aifc.py:    def setparams(self, (nchannels, sampwidth, framerate,
nframes, comptype, compname)):
bdb.py:    def user_exception(self, frame, (exc_type, exc_value,
exc_traceback)):
binhex.py:    def __init__(self, (name, finfo, dlen, rlen), ofp):
cgitb.py:def html((etype, evalue, etb), context=5):
cgitb.py:def text((etype, evalue, etb), context=5):
compiler/ast.py:    def __init__(self, (left, right), lineno=None):
compiler/ast.py:    def __init__(self, (left, right), lineno=None):
compiler/ast.py:    def __init__(self, (left, right), lineno=None):
compiler/ast.py:    def __init__(self, (left, right), lineno=None):
compiler/ast.py:    def __init__(self, (left, right), lineno=None):
compiler/ast.py:    def __init__(self, (left, right), lineno=None):
compiler/ast.py:    def __init__(self, (left, right), lineno=None):
compiler/ast.py:    def __init__(self, (left, right), lineno=None):
compiler/ast.py:    def __init__(self, (left, right), lineno=None):
formatter.py:    def push_font(self, (size, i, b, tt)):
idlelib/Debugger.py:    def show_frame(self, (frame, lineno)):
imputil.py:    def _process_result(self, (ispkg, code, values), fqname):
inspect.py:    def tokeneater(self, type, token, (srow, scol), (erow,
ecol), line):
lib-old/fmt.py:    def text(self, (h, v), str):
lib-old/fmt.py:    def text(self, (h, v), text):
modulefinder.py:    def load_module(self, fqname, fp, pathname,
(suffix, mode, type)):
pdb.py:    def user_exception(self, frame, (exc_type, exc_value,
exc_traceback)):
plat-irix5/flp.py:def create_full_form(inst, (fdata, odatalist)):
plat-irix5/flp.py:def merge_full_form(inst, form, (fdata, odatalist)):
plat-irix6/flp.py:def create_full_form(inst, (fdata, odatalist)):
plat-irix6/flp.py:def merge_full_form(inst, form, (fdata, odatalist)):
plat-mac/findertools.py:def _setlocation(object_alias, (x, y)):
plat-mac/findertools.py:def _setwindowsize(folder_alias, (w, h)):
plat-mac/findertools.py:def _setwindowposition(folder_alias, (x, y)):
pydoc.py:    def fixup((name, kind, cls, value)):
pydoc.py:    def __init__(self, filename, (exc, value, tb)):
pydoc.py:    def modpkglink(self, (name, path, ispackage, shadowed)):
pydoc.py:    def submodules(self, (dir, package)):
pydoc.py:    def isnewpackage(self, (dir, package)):
sunau.py:    def setparams(self, (nchannels, sampwidth, framerate,
nframes, comptype, compname)):
test/inspect_fodder.py:def spam(a, b, c, d=3, (e, (f,))=(4, (5,)), *g, **h):
test/test_compile.py:        def comp_args((a, b)):
test/test_compile.py:        def comp_args((a, b)=(3, 4)):
test/test_compile.py:        def comp_args(a, (b, c)):
Binary file test/test_compile.pyc matches
test/test_grammar.py:def f4(two, (compound, (argument, list))): pass
test/test_grammar.py:def f5((compound, first), two): pass
test/test_grammar.py:def v3(a, (b, c), *rest): return a, b, c, rest
test/test_math.py:def testfrexp(name, (mant, exp), (emant, eexp)):
test/test_math.py:def testmodf(name, (v1, v2), (e1, e2)):
Binary file test/test_parser.pyc matches
test/test_scope.py:def makeAddPair((a, b)):
test/test_scope.py:    def addPair((c, d)):
test/test_threadsignals.py:def registerSignals((for_usr1, for_usr2, for_alrm)):
threading.py:    def _acquire_restore(self, (count, owner)):
tokenize.py:def printtoken(type, token, (srow, scol), (erow, ecol),
line): # for testing
urlparse.py:def urlunparse((scheme, netloc, url, params, query, fragment)):
urlparse.py:def urlunsplit((scheme, netloc, url, query, fragment)):
wave.py:    def setparams(self, (nchannels, sampwidth, framerate,
nframes, comptype, compname)):

Not to mention the dozen or so in my own codebase.

STeVe
-- 
You can wordify anything if you just verb it.
        --- Bucky Katt, Get Fuzzy


More information about the Python-Dev mailing list