Lines Matching +full:fast +full:- +full:deep +full:- +full:equal
1 :mod:`collections` --- Container datatypes
18 --------------
21 Python's general purpose built-in containers, :class:`dict`, :class:`list`,
26 :class:`deque` list-like container with fast appends and pops on either end
27 :class:`ChainMap` dict-like class for creating a single view of multiple mappings
38 -------------------------
71 first-searched to last-searched. It is the only stored state and can
98 scope>`. The use cases also parallel those for the built-in
131 for templating is a read-only chain of mappings. It also features
141 * A `greatly simplified read-only version of Chainmap
156 Example of letting user specified command-line arguments take precedence over
164 parser.add_argument('-u', '--user')
165 parser.add_argument('-c', '--color')
179 e.maps[0] # Current context dictionary -- like Python's locals()
180 e.maps[-1] # Root context -- like Python's globals()
181 e.parents # Enclosing context chain -- like Python's nonlocals
194 if deep writes and deletions are desired, it is easy to make a subclass that
223 ------------------------
242 .. class:: Counter([iterable-or-mapping])
288 >>> c = Counter(a=4, b=2, c=0, d=-2)
297 Elements with equal counts are ordered in the order first encountered:
302 .. method:: subtract([iterable-or-mapping])
308 >>> c = Counter(a=4, b=2, c=0, d=-2)
312 Counter({'a': 3, 'b': 0, 'c': -3, 'd': -6})
333 .. method:: update([iterable-or-mapping])
335 Elements are counted from an *iterable* or added-in from another
362 c.most_common()[:-n-1:-1] # n least common elements
379 >>> c - d # subtract (keeping only positive counts)
393 >>> c = Counter(a=2, b=-4)
396 >>> -c
400 Added support for unary plus, unary minus, and in-place multiset operations.
415 * For in-place operations such as ``c[key] += 1``, the value type need only
431 * `Bag class <https://www.gnu.org/software/smalltalk/manual-base/html_node/Bag.html>`_
436 …* `C++ multisets <http://www.java2s.com/Tutorial/Cpp/0380__set-multiset/Catalog0380__set-multiset.…
446 map(Counter, combinations_with_replacement('ABC', 2)) # --> AA AB AC BB BC CC
450 ----------------------
454 Returns a new deque object initialized left-to-right (using :meth:`append`) with
458 and is short for "double-ended queue"). Deques support thread-safe, memory
463 fast fixed-length operations and incur O(n) memory movement costs for
503 Count the number of deque elements equal to *x*.
560 Reverse the elements of the deque in-place and then return ``None``.
575 Deque objects also provide one read-only attribute:
588 the middle. For fast random access, use lists instead.
618 >>> d[-1] # peek at rightmost item
631 >>> d.rotate(-1) # left rotation
640 File "<pyshell#6>", line 1, in -toplevel-
666 # moving_average([40, 30, 50, 46, 39, 44]) --> 40.0 42.0 45.0 43.0
669 d = deque(itertools.islice(it, n-1))
673 s += elem - d.popleft()
677 A `round-robin scheduler
678 <https://en.wikipedia.org/wiki/Round-robin_scheduling>`_ can be implemented with
685 "roundrobin('ABC', 'D', 'EF') --> A D E B F C"
691 iterators.rotate(-1)
701 d.rotate(-n)
715 ----------------------------
719 Return a new dictionary-like object. :class:`defaultdict` is a subclass of the
720 built-in :class:`dict` class. It overrides one method and adds one writable
773 sequence of key-value pairs into a dictionary of lists:
787 again, the look-up proceeds normally (returning the list for that key) and the
839 ----------------------------------------------------------------
842 self-documenting code. They can be used wherever regular tuples are used, and
848 create tuple-like objects that have fields accessible by attribute lookup as
878 Named tuple instances do not have per-instance dictionaries, so they are
889 :ref:`keyword-only arguments <keyword-only_parameter>`.
1013 To convert a dictionary to a named tuple, use the double-star-operator
1014 (as described in :ref:`tut-unpacking-arguments`):
1022 a fixed-width print format:
1052 >>> Book.id.__doc__ = '13-digit ISBN'
1074 automatically adding generated special methods to user-defined classes.
1078 ----------------------------
1082 important now that the built-in :class:`dict` class gained the ability
1139 :abbr:`LIFO (last-in, first-out)` order if *last* is true
1140 or :abbr:`FIFO (first-in, first-out)` order if false.
1164 Equality tests between :class:`OrderedDict` objects are order-sensitive
1167 :class:`~collections.abc.Mapping` objects are order-insensitive like regular
1219 if time() - timestamp <= self.maxage:
1234 To avoid flushing the LRU cache with one-time requests,
1297 -------------------------
1324 -------------------------
1327 for your own list-like classes which can inherit from them and override
1364 ---------------------------
1378 be any object which can be converted into a string using the built-in