Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!teal.octanews.net!news-out.octanews.net!indigo.octanews.net!news.glorb.com!news.astraweb.com!border6.newsrouter.astraweb.com!not-for-mail From: Ben Finney Newsgroups: comp.lang.python Subject: Re: Square bracket and dot notations? References: <4ab9f6bd-cf2d-4c0a-8eda-7d8ffa6bd6c4@v10g2000yqn.googlegroups.com> X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-pubkey.asc X-Post-From: Ben Finney Date: Sat, 11 Jun 2011 20:11:17 +1000 Message-ID: <87fwngvfsq.fsf@benfinney.id.au> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) Cancel-Lock: sha1:t7dd0reKHpK93kBUSwruoAJowCo= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Lines: 33 Organization: Unlimited download news at news.astraweb.com NNTP-Posting-Host: 1ade2e95.news.astraweb.com X-Trace: DXC=SgV2<`KImIQ?W?WaA writes: > I am beginner in Python. What is interesting for me is that Python > interpreter treats in different way dot and square bracket notations. > I am coming from JavaScript where both notations lead prototype chain > lookup. Run, don't walk, to the Python Tutorial. Work through each section, do the examples, experiement to get an understanding of the examples, and then continue. > In Python it seems square bracket and dot notations lead lookup in > different "store". That's right. Square bracket syntax accesses an object's items, dot syntax accesses an object's attributes. > Anyway, I would like to know more about the lookup for key of dict and > lookup for property of any object with dot notation. Any materials and > explanations are highly appreciated. Work through the tutorial from beginning to end to get a good grounding in this and other fundamentals. Welcome to the language, and enjoy your learning! -- \ “Most people, I think, don't even know what a rootkit is, so | `\ why should they care about it?” —Thomas Hesse, Sony BMG, 2006 | _o__) | Ben Finney