3 ms·
It's also used for creating lists, but [] is syntax for retrieving a value from a container: https://docs.python.org/2/reference/datamodel.html#emulating-conta
by maxerickson 12y ago
It's also used for creating lists, but [] is syntax for retrieving a value from a container:
https://docs.python.org/2/reference/datamodel.html#emulating-container-types https://docs.python.org/2/reference/datamodel.html#emulating...
Or, the earliest I could quickly find:
https://docs.python.org/release/1.5/ref/ref-5.html#HEADING5-98 https://docs.python.org/release/1.5/ref/ref-5.html#HEADING5-...
The access pattern is probably the right aspect to make consistent (at least in the context of duck typing). If the access isn't generalized across various types they might as well use named methods.
edit: I corrected the anchor in the second link.