Skip to content

Commit

Permalink
added documentation in the docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
timrid authored and arekbulski committed May 22, 2021
1 parent 031049e commit fa0a74f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions construct/lib/containers.py
Expand Up @@ -60,6 +60,8 @@ class Container(collections.OrderedDict):
r"""
Generic ordered dictionary that allows both key and attribute access, and preserves key order by insertion. Adding keys is preferred using \*\*entrieskw (requires Python 3.6). Equality does NOT check item order. Also provides regex searching.
Note that not all parameters can be accessed via attribute access (dot operator). If the name of an item matches a method name of the Container, it can only be accessed via key acces (square brackets). This includes the following names: clear, copy, fromkeys, get, items, keys, move_to_end, pop, popitem, search, search_all, setdefault, update, values.
Example::
# empty dict
Expand Down
2 changes: 1 addition & 1 deletion docs/basics.rst
Expand Up @@ -127,7 +127,7 @@ Thanks to blapid, containers can also be searched. Structs nested within Structs
>>> con.search_all("a")
[1, 2]

Note that not all parameters can be accessed via the dot operator. If the name of an item matches a method name of the Container (which is based on a dict), it can only be accessed via the square brackets. This includes the following names: clear, copy, fromkeys, get, items, keys, move_to_end, pop, popitem, search, search_all, setdefault, update, values.
Note that not all parameters can be accessed via attribute access (dot operator). If the name of an item matches a method name of the Container (which is based on a dict), it can only be accessed via key acces (square brackets). This includes the following names: clear, copy, fromkeys, get, items, keys, move_to_end, pop, popitem, search, search_all, setdefault, update, values.

>>> con = Container(update=5)
>>> con["update"]
Expand Down

0 comments on commit fa0a74f

Please sign in to comment.