Path: csiph.com!news.mixmin.net!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!fu-berlin.de!uni-berlin.de!not-for-mail From: Peter Otten <__peter__@web.de> Newsgroups: comp.lang.python Subject: Re: Is there an meaning of '[[]]' in a list? Date: Thu, 19 Nov 2015 12:40:17 +0100 Organization: None Lines: 41 Message-ID: References: <750e1071-395b-4e9b-ad64-05faa174a5bf@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Trace: news.uni-berlin.de JakreLKhCR+I09FqaH61XQzeWIRhKzUzg6ZGC734hGtQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'assignment': 0.07; 'confuse': 0.09; 'level:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; '[[]]': 0.16; 'commandline': 0.16; 'experiments': 0.16; 'hint:': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'wrote:': 0.16; 'nested': 0.18; '>>>': 0.20; 'this:': 0.23; 'header:User-Agent:1': 0.26; 'subject:list': 0.26; 'header:X-Complaints-To:1': 0.26; 'question': 0.27; 'entries': 0.27; 'question:': 0.29; 'skip:i 60': 0.29; "i'm": 0.30; 'posts': 0.30; 'previous': 0.34; 'lists': 0.34; 'list': 0.34; 'list:': 0.35; 'there': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'difference': 0.38; 'hi,': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'questions': 0.40; 'your': 0.60; 'between': 0.65; 'limit': 0.65; 'subject:there': 0.66; "'foo'": 0.84; 'experiment': 0.84 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: p57bd891b.dip0.t-ipconnect.de User-Agent: KNode/4.13.3 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:99045 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'