"Mark Tolonen" <[EMAIL PROTECTED]> writes:

> <[EMAIL PROTECTED]> wrote:
> > I'm after
> > [[[],[],[],[],[]],[[],[],[],[],[]],[[],[],[],[],[]],[[],[],[],[],[]],[[],[],[],[],[]]]
> 
> How about:
> 
> >>> [[[]]*5]*5
> [[[], [], [], [], []], [[], [], [], [], []], [[], [], [], [], []],
> [[], [], [], [], []], [[], [], [], [], []]]

Not too useful.

    >>> foo = [[[]] * 5] * 5
    >>> foo
    [[[], [], [], [], []], [[], [], [], [], []], [[], [], [], [], []], [[], [], 
[], [], []], [[], [], [], [], []]]
    >>> foo[0][0].append("spam")
    >>> foo
    [[['spam'], ['spam'], ['spam'], ['spam'], ['spam']], [['spam'], ['spam'], 
['spam'], ['spam'], ['spam']], [['spam'], ['spam'], ['spam'], ['spam'], 
['spam']], [['spam'], ['spam'], ['spam'], ['spam'], ['spam']], [['spam'], 
['spam'], ['spam'], ['spam'], ['spam']]]

As made clear in the rest of the thread, the OP wants every one of
those lists to be different objects.

-- 
 \        "To me, boxing is like a ballet, except there's no music, no |
  `\       choreography, and the dancers hit each other." —Jack Handey |
_o__)                                                                  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to