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


Groups > comp.lang.python > #99045

Re: Is there an meaning of '[[]]' in a list?

From Peter Otten <__peter__@web.de>
Newsgroups comp.lang.python
Subject Re: Is there an meaning of '[[]]' in a list?
Date 2015-11-19 12:40 +0100
Organization None
Message-ID <mailman.454.1447933236.16136.python-list@python.org> (permalink)
References <750e1071-395b-4e9b-ad64-05faa174a5bf@googlegroups.com>

Show all headers | View raw


fl wrote:

> Hi,
> In the previous exercises, I see list:
> cc=[[],[],[]]
> 
> Then, I can have this:
> 
> ccc=[[[]],[[]],[[]]]
> 
> I can also have
> 
> ccc[0]
> Out[158]: [[]]
> 
> ccc[0]='o'
> 
> ccc
> Out[163]: ['o', [[]], [[]]]
> 
> 
> I have question: Is there any difference between [[]] and []?
> [[]] can have deeper assignment and use than
> 
> ccc[0]='o'

I'm sure with a little effort and a few experiments on the commandline you 
can answer your question yourself. Please limit your posts to c.l.py to 
those questions that are a little harder.

Hint: when you experiment with nested lists use numbers, not strings as list 
entries that are not lists themselves. Strings can confuse you about the 
nesting level:

>>> items = ["foo"]
>>> items[0]
'foo'
>>> items[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0]
'f'

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


Thread

Is there an meaning of '[[]]' in a list? fl <rxjwg98@gmail.com> - 2015-11-19 03:28 -0800
  Re: Is there an meaning of '[[]]' in a list? Nagy László Zsolt <gandalf@shopzeus.com> - 2015-11-19 12:36 +0100
  Re: Is there an meaning of '[[]]' in a list? Peter Otten <__peter__@web.de> - 2015-11-19 12:40 +0100
    Re: Is there an meaning of '[[]]' in a list? Quivis <quivis@domain.invalid> - 2015-11-22 23:25 +0000
      Re: Is there an meaning of '[[]]' in a list? Joel Goldstick <joel.goldstick@gmail.com> - 2015-11-22 19:08 -0500
      Re: Is there an meaning of '[[]]' in a list? Peter Otten <__peter__@web.de> - 2015-11-23 09:57 +0100
      Re: Is there an meaning of '[[]]' in a list? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-25 12:04 +0100
  Re: Is there an meaning of '[[]]' in a list? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-11-19 16:26 +0000

csiph-web