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


Groups > comp.lang.python > #98522

Using tuple as parameter to a function

Path csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Cecil Westerhof <Cecil@decebal.nl>
Newsgroups comp.lang.python
Subject Using tuple as parameter to a function
Date Mon, 09 Nov 2015 14:40:00 +0100
Organization Decebal Computing
Lines 40
Message-ID <87io5b5m1b.fsf@Equus.decebal.nl> (permalink)
Mime-Version 1.0
Content-Type text/plain
Injection-Info mx02.eternal-september.org; posting-host="528adfd6ad074c92fdc6a7f8fb9e23d8"; logging-data="11374"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Ddvu1l0vySC9YBtSwiPaHCCDLJq43nt4="
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
X-Homepage http://www.decebal.nl/
Cancel-Lock sha1:6T6IaKSuDSA7CWi1y+8VE8an7P0= sha1:WkEIlDbfaspAW+g15zQIHv2agrs=
Xref csiph.com comp.lang.python:98522

Show key headers only | View raw


At the moment I have the following calls:
    do_stress_test(  1, 100)
    do_stress_test(  2, 100)
    do_stress_test(  5, 100)
    do_stress_test( 10, 100)
    do_stress_test( 20, 100)
    do_stress_test( 40, 100)

In principal I want to change it to something like:
    do_stress_test('sqlite',    1, 100)
    do_stress_test('postgres',  1, 100)
    do_stress_test('sqlite',    2, 100)
    do_stress_test('postgres',  2, 100)
    do_stress_test('sqlite',    5, 100)
    do_stress_test('postgres',  5, 100)
    do_stress_test('sqlite',   10, 100)
    do_stress_test('postgres', 10, 100)
    do_stress_test('sqlite',   20, 100)
    do_stress_test('postgres', 20, 100)
    do_stress_test('sqlite',   40, 100)
    do_stress_test('postgres', 40, 100)

But that would not be very dry.

I was thinking about something like:
    values = (( 1, 100), ( 2, 100), ( 5, 100),
               10, 100), (20, 100), (40, 100))
    for value in values:
        do_stress_test('sqlite',   ???)
        do_stress_test('postgres', ???)

Is this possible? If so: what do I put at the place of the '???'?

I could change the second and third parameter to a tuple as the second
parameter, but I prefer three parameters if that would be possible.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

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


Thread

Using tuple as parameter to a function Cecil Westerhof <Cecil@decebal.nl> - 2015-11-09 14:40 +0100
  Re: Using tuple as parameter to a function Chris Angelico <rosuav@gmail.com> - 2015-11-10 00:58 +1100
    Re: Using tuple as parameter to a function marco.nawijn@colosso.nl - 2015-11-09 06:57 -0800
    Re: Using tuple as parameter to a function Cecil Westerhof <Cecil@decebal.nl> - 2015-11-09 16:01 +0100
      Re: Using tuple as parameter to a function Chris Angelico <rosuav@gmail.com> - 2015-11-10 02:24 +1100
        Re: Using tuple as parameter to a function Cecil Westerhof <Cecil@decebal.nl> - 2015-11-09 18:54 +0100

csiph-web