Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #26782

Re: Is there a clever way to pass arguments

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <prvs=5616645fc=jeanmichel@sequans.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'argument': 0.04; 'arguments': 0.07; 'list?': 0.07; 'python': 0.09; 'cc:addr:python- list': 0.10; 'index': 0.13; 'definition.': 0.16; 'parameters,': 0.16; 'sequential': 0.16; 'subject:pass': 0.16; 'wrote:': 0.17; 'thanks,': 0.18; 'cc:2**0': 0.23; 'bruce': 0.23; 'statement': 0.23; 'cc:no real name:2**0': 0.24; 'pass': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'clever': 0.29; 'function': 0.30; 'handle': 0.33; 'list': 0.35; 'there': 0.35; 'does': 0.37; 'listing': 0.37; 'subject:: ': 0.38; 'received:194': 0.61; 'email addr:gmail.com': 0.63; 'subject:there': 0.65
X-IronPort-AV E=Sophos;i="4.77,739,1336341600"; d="scan'208";a="643961"
X-Virus-Scanned amavisd-new at zimbra.sequans.com
Date Thu, 09 Aug 2012 11:05:30 +0200
From Jean-Michel Pichavant <jeanmichel@sequans.com>
User-Agent Mozilla-Thunderbird 2.0.0.24 (X11/20100328)
MIME-Version 1.0
To bruceg113355@gmail.com
Subject Re: Is there a clever way to pass arguments
References <0aaad6e4-8751-4073-bf9c-14285c1f3422@googlegroups.com>
In-Reply-To <0aaad6e4-8751-4073-bf9c-14285c1f3422@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3096.1344503139.4697.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1344503139 news.xs4all.nl 6860 [2001:888:2000:d::a6]:59873
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:26782

Show key headers only | View raw


bruceg113355@gmail.com wrote:
> Is there a way in Python to pass arguments without listing each argument?
> For example, my program does the following:
>
>     testData (z[0], z[1], z[2], z[3], z[4], z[5], z[6], z[7])
>
> Is there a clever way to pass arguments in a single statement knowing that each argument is a sequential index from a list?
> I cannot change the function definition.
>
> Thanks,
> Bruce
>   
testData(*z)

or better (imo)

testData(z) and make testData handle a list (8 parameters, that's a lot 
of parameters).

JM

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Is there a clever way to pass arguments bruceg113355@gmail.com - 2012-08-08 17:41 -0700
  Re: Is there a clever way to pass arguments Andrew Cooper <amc96@cam.ac.uk> - 2012-08-09 01:47 +0100
  Re: Is there a clever way to pass arguments Dave Angel <d@davea.name> - 2012-08-08 21:07 -0400
    Re: Is there a clever way to pass arguments bruceg113355@gmail.com - 2012-08-08 18:20 -0700
    Re: Is there a clever way to pass arguments bruceg113355@gmail.com - 2012-08-08 18:20 -0700
      Re: Is there a clever way to pass arguments Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-09 01:34 +0000
  Re: Is there a clever way to pass arguments Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-08-09 11:05 +0200
  Re: Is there a clever way to pass arguments Chris Angelico <rosuav@gmail.com> - 2012-08-09 19:13 +1000
    Re: Is there a clever way to pass arguments Alister <alister.ware@ntlworld.com> - 2012-08-09 17:14 +0000
      Re: Is there a clever way to pass arguments GangGreene <GangGreene@invalid.com> - 2012-08-09 15:39 -0400
  Re: Is there a clever way to pass arguments Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-08-09 11:50 +0200
  Re: Is there a clever way to pass arguments Terry Reedy <tjreedy@udel.edu> - 2012-08-09 15:48 -0400

csiph-web