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


Groups > comp.lang.python > #98522

Using tuple as parameter to a function

From Cecil Westerhof <Cecil@decebal.nl>
Newsgroups comp.lang.python
Subject Using tuple as parameter to a function
Date 2015-11-09 14:40 +0100
Organization Decebal Computing
Message-ID <87io5b5m1b.fsf@Equus.decebal.nl> (permalink)

Show all headers | 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