Square bracket and dot notations?
Ben Finney
ben+python at benfinney.id.au
Sat Jun 11 06:11:17 EDT 2011
More information about the Python-list mailing list
Sat Jun 11 06:11:17 EDT 2011
- Previous message (by thread): Square bracket and dot notations?
- Next message (by thread): Square bracket and dot notations?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Asen Bozhilov <asen.bozhilov at 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
- Previous message (by thread): Square bracket and dot notations?
- Next message (by thread): Square bracket and dot notations?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list