Re: Help building a dictionary of lists

2012-11-13 Thread Thomas Bach
On Mon, Nov 12, 2012 at 11:41:59PM +, Joshua Landau wrote: Dict comprehension: {i:[] for i in [Test 1, Test 2, Test 3]} In Python 2.6 this syntax is not supported. You can achieve the same there via dict((i, []) for i in ['Test 1', 'Test 2', 'Test 3']) Also have a look at

Help building a dictionary of lists

2012-11-12 Thread NJ1706
Chaps, I am new to Python have inherited a test harness written in the language that I am trying to extend. The following code shows how dictionaries holding lists of commands are handled in the script... Start of Code_1 #! /usr/bin/python # List of tests TestList = ( 'Test_1',

Re: Help building a dictionary of lists

2012-11-12 Thread Joshua Landau
On 12 November 2012 22:26, NJ1706 nickj1...@googlemail.com wrote: Chaps, I am new to Python have inherited a test harness written in the language that I am trying to extend. The following code shows how dictionaries holding lists of commands are handled in the script... Start of Code_1

Re: Help building a dictionary of lists

2012-11-12 Thread Joshua Landau
On 12 November 2012 22:26, NJ1706 nickj1...@googlemail.com wrote: # List of tests TestList = ( 'Test_1', 'Test_2' ) Note that TestList is a *tuple*, not a list. You normally would want to write test_names instead of TestList for several reasons: * Unless it's a class, Python