collections.somenamedtuple._make()

classmethod somenamedtuple._make(iterable) Class method that makes a new instance from an existing sequence or iterable. >>> t = [11, 22] >>> Point._make(t) Point(x=11, y=22)

collections.somenamedtuple._asdict()

somenamedtuple._asdict() Return a new OrderedDict which maps field names to their corresponding values: >>> p = Point(x=11, y=22) >>> p._asdict() OrderedDict([('x', 11), ('y', 22)]) Changed in version 3.1: Returns an OrderedDict instead of a regular dict.

collections.somenamedtuple._replace()

somenamedtuple._replace(kwargs) Return a new instance of the named tuple replacing specified fields with new values: >>> p = Point(x=11, y=22) >>> p._replace(x=33) Point(x=33, y=22) >>> for partnum, record in inventory.items(): ... inventory[partnum] = record._replace(price=newprices[partnum], timestamp=time.now())

collections.deque.reverse()

reverse() Reverse the elements of the deque in-place and then return None. New in version 3.2.

collections.deque.rotate()

rotate(n) Rotate the deque n steps to the right. If n is negative, rotate to the left. Rotating one step to the right is equivalent to: d.appendleft(d.pop()).

collections.OrderedDict.move_to_end()

move_to_end(key, last=True) Move an existing key to either end of an ordered dictionary. The item is moved to the right end if last is true (the default) or to the beginning if last is false. Raises KeyError if the key does not exist: >>> d = OrderedDict.fromkeys('abcde') >>> d.move_to_end('b') >>> ''.join(d.keys()) 'acdeb' >>> d.move_to_end('b', last=False) >>> ''.join(d.keys()) 'bacde' New in version 3.2.

collections.namedtuple()

collections.namedtuple(typename, field_names, verbose=False, rename=False) Returns a new tuple subclass named typename. The new subclass is used to create tuple-like objects that have fields accessible by attribute lookup as well as being indexable and iterable. Instances of the subclass also have a helpful docstring (with typename and field_names) and a helpful __repr__() method which lists the tuple contents in a name=value format. The field_names are a single string with each fieldname se

collections.OrderedDict

class collections.OrderedDict([items]) Return an instance of a dict subclass, supporting the usual dict methods. An OrderedDict is a dict that remembers the order that keys were first inserted. If a new entry overwrites an existing entry, the original insertion position is left unchanged. Deleting an entry and reinserting it will move it to the end. New in version 3.1. popitem(last=True) The popitem() method for ordered dictionaries returns and removes a (key, value) pair. The pairs are

collections.deque.maxlen

maxlen Maximum size of a deque or None if unbounded. New in version 3.1.

collections.deque.remove()

remove(value) Remove the first occurrence of value. If not found, raises a ValueError.