lists changed to tuples unexpectedly!

Dennis Lee Bieber wlfraed at ix.netcom.com
Thu Nov 14 22:45:52 EST 2002


Chris Fonnesbeck fed this fish to the penguins on Thursday 14 November 
2002 06:44 am:

        <snip>

> 
> Why did I make lists, and get tuples?
>
        Those aren't tuples... Tuples display with (...).

        They /are/, however, a list containing lists of lists...

        What you *initially* made (actions) is a LIST of TUPLES:

>>> actions = [(((i,0),),((j,j),)) for i in (0,1,2,3,4) for j in
... (0.0,0.1,0.2)]
>>> import pprint
>>> pprint.pprint(actions)
[(((0, 0),), ((0.0, 0.0),)),
 (((0, 0),), ((0.10000000000000001, 0.10000000000000001),)),
 (((0, 0),), ((0.20000000000000001, 0.20000000000000001),)),
 (((1, 0),), ((0.0, 0.0),)),
 (((1, 0),), ((0.10000000000000001, 0.10000000000000001),)),
 (((1, 0),), ((0.20000000000000001, 0.20000000000000001),)),
 (((2, 0),), ((0.0, 0.0),)),
 (((2, 0),), ((0.10000000000000001, 0.10000000000000001),)),
 (((2, 0),), ((0.20000000000000001, 0.20000000000000001),)),
 (((3, 0),), ((0.0, 0.0),)),
 (((3, 0),), ((0.10000000000000001, 0.10000000000000001),)),
 (((3, 0),), ((0.20000000000000001, 0.20000000000000001),)),
 (((4, 0),), ((0.0, 0.0),)),
 (((4, 0),), ((0.10000000000000001, 0.10000000000000001),)),
 (((4, 0),), ((0.20000000000000001, 0.20000000000000001),))]
>>> a = actions[0]
>>> a
(((0, 0),), ((0.0, 0.0),))

        We'd have to see the full definition of your QOptimizer class, AND the 
invocation, to make any guess as to what happened inside it.



-- 
 > ============================================================== <
 >   wlfraed at ix.netcom.com  | Wulfraed  Dennis Lee Bieber  KD6MOG <
 >      wulfraed at dm.net     |       Bestiaria Support Staff       <
 > ============================================================== <
 >        Bestiaria Home Page: http://www.beastie.dm.net/         <
 >            Home Page: http://www.dm.net/~wulfraed/             <




More information about the Python-list mailing list