Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #7442
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Square bracket and dot notations? |
| References | <4ab9f6bd-cf2d-4c0a-8eda-7d8ffa6bd6c4@v10g2000yqn.googlegroups.com> |
| Date | 2011-06-11 20:11 +1000 |
| Message-ID | <87fwngvfsq.fsf@benfinney.id.au> (permalink) |
| Organization | Unlimited download news at news.astraweb.com |
Asen Bozhilov <asen.bozhilov@gmail.com> 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.
<URL:http://docs.python.org/tutorial/>
> 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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Square bracket and dot notations? Asen Bozhilov <asen.bozhilov@gmail.com> - 2011-06-11 02:41 -0700
Re: Square bracket and dot notations? Andrew Berg <bahamutzero8825@gmail.com> - 2011-06-11 05:06 -0500
Re: Square bracket and dot notations? Ben Finney <ben+python@benfinney.id.au> - 2011-06-11 20:11 +1000
Re: Square bracket and dot notations? Francesco Bochicchio <bieffe62@gmail.com> - 2011-06-11 03:46 -0700
Re: Square bracket and dot notations? Asen Bozhilov <asen.bozhilov@gmail.com> - 2011-06-11 07:40 -0700
Re: Square bracket and dot notations? Terry Reedy <tjreedy@udel.edu> - 2011-06-11 15:49 -0400
Re: Square bracket and dot notations? Asen Bozhilov <asen.bozhilov@gmail.com> - 2011-06-11 13:41 -0700
csiph-web