Module Assign NameStore ListLoad Str ImportFrom alias identifier ImportFrom alias identifier Import alias identifier TryExcept body ImportFrom alias handlers ExceptHandler type NameLoad body FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str If Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Str Str attr Assign NameStore Call NameLoad Call NameLoad NameLoad NameLoad For NameStore BinOpAdd TupleLoad NameLoad NameLoad body If UnaryOpNot Call NameLoad GeneratorExp BoolOpOr Call AttributeLoad NameLoad attr CompareEq NameLoad Str comprehension NameStore NameLoad body Raise Call NameLoad BinOpMod Str NameLoad If Call NameLoad NameLoad body Raise Call NameLoad BinOpMod Str NameLoad If Call AttributeLoad SubscriptLoad NameLoad Index Num attr body Raise Call NameLoad BinOpMod Str NameLoad Assign NameStore Call NameLoad For NameStore NameLoad body If Call AttributeLoad NameLoad attr Str body Raise Call NameLoad BinOpMod Str NameLoad If CompareIn NameLoad NameLoad body Raise Call NameLoad BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore SubscriptLoad Call AttributeLoad Call NameLoad NameLoad attr Str Str Slice Num Num Assign NameStore Call AttributeLoad Str attr GeneratorExp BinOpMod Str NameLoad comprehension NameStore NameLoad Assign NameStore Call AttributeLoad Str attr GeneratorExp BinOpMod Str TupleLoad NameLoad NameLoad comprehension TupleStore NameStore NameStore Call NameLoad NameLoad Assign NameStore BinOpMod Str Call NameLoad For TupleStore NameStore NameStore Call NameLoad NameLoad body AugAssignAdd NameStore BinOpMod Str TupleLoad NameLoad NameLoad If NameLoad body Print NameLoad Assign NameStore Call NameLoad keyword NameLoad keyword BinOpMod Str NameLoad TryExcept body Exec NameLoad NameLoad handlers ExceptHandler type NameLoad name NameStore body Raise Call NameLoad BinOpAdd BinOpAdd AttributeLoad NameLoad attr Str NameLoad Assign NameStore SubscriptLoad NameLoad Index NameLoad If Call NameLoad NameLoad Str body Assign AttributeStore NameLoad attr SubscriptLoad AttributeLoad Call AttributeLoad NameLoad attr Num attr Index Str Return NameLoad decorator_list If CompareEq NameLoad Str body ImportFrom alias alias Assign NameStore Call NameLoad Str Str NameLoad Assign NameStore Call NameLoad keyword Num keyword Num Assert CompareEq NameLoad Call NameLoad Call NameLoad NameLoad ClassDef bases Call NameLoad Str Str body Assign NameStore TupleLoad FunctionDef arguments args NameParam defaults body Return BinOpPow BinOpAdd BinOpPow AttributeLoad NameLoad attr Num BinOpPow AttributeLoad NameLoad attr Num Num decorator_list NameLoad FunctionDef arguments args NameParam defaults body Return BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list decorator_list For NameStore TupleLoad Call NameLoad Num Num Call NameLoad Num BinOpDiv Num Num body Print NameLoad ClassDef bases Call NameLoad Str Str body Expr Str Assign NameStore TupleLoad Assign NameStore Call NameLoad AttributeLoad NameLoad attr FunctionDef arguments args NameParam NameParam defaults NameLoad kwarg body Return Call AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr TupleLoad Str Str NameLoad decorator_list decorator_list Print Call AttributeLoad Call NameLoad Num Num attr keyword Num Assign NameStore Call NameLoad Str BinOpAdd AttributeLoad NameLoad attr TupleLoad Str Print AttributeLoad NameLoad attr Import alias Assign NameStore Call NameLoad Str Str Print Call NameLoad Call AttributeLoad NameLoad attr
N/A N/A __all__ N/A namedtuple operator itemgetter _itemgetter keyword iskeyword _iskeyword N/A sys _sys N/A N/A collections namedtuple N/A N/A N/A ImportError N/A namedtuple N/A N/A typename field_names verbose N/A False N/A N/A Returns a new subclass of tuple with named fields.

    >>> Point = namedtuple('Point', 'x y')
    >>> Point.__doc__                   # docstring for the new class
    'Point(x, y)'
    >>> p = Point(11, y=22)             # instantiate with positional args or keywords
    >>> p[0] + p[1]                     # indexable like a plain tuple
    33
    >>> x, y = p                        # unpack like a regular tuple
    >>> x, y
    (11, 22)
    >>> p.x + p.y                       # fields also accessable by name
    33
    >>> d = p._asdict()                 # convert to a dictionary
    >>> d['x']
    11
    >>> Point(**d)                      # convert from a dictionary
    Point(x=11, y=22)
    >>> p._replace(x=100)               # _replace() is like str.replace() but targets named fields
    Point(x=100, y=22)

     N/A N/A isinstance field_names basestring N/A N/A field_names N/A N/A N/A N/A field_names replace , split N/A field_names N/A tuple N/A map str field_names N/A name N/A N/A typename field_names N/A N/A N/A N/A all N/A N/A N/A N/A c isalnum N/A c _ N/A c name N/A N/A N/A ValueError N/A Type names and field names can only contain alphanumeric characters and underscores: %r name N/A N/A _iskeyword name N/A N/A N/A ValueError N/A Type names and field names cannot be a keyword: %r name N/A N/A N/A N/A name N/A 0 isdigit N/A N/A N/A ValueError N/A Type names and field names cannot start with a number: %r name N/A seen_names N/A set N/A name field_names N/A N/A N/A N/A name startswith _ N/A N/A N/A ValueError N/A Field names cannot start with an underscore: %r name N/A N/A name seen_names N/A N/A N/A ValueError N/A Encountered duplicate field name: %r name N/A N/A N/A seen_names add name N/A numfields N/A len field_names N/A argtxt N/A N/A N/A N/A repr field_names replace ' N/A 1 -1 N/A reprtxt N/A N/A ,  join N/A N/A %s=%%r name N/A name field_names N/A dicttxt N/A N/A ,  join N/A N/A %r: t[%d] N/A name pos N/A N/A pos name N/A enumerate field_names N/A template N/A class %(typename)s(tuple):
        '%(typename)s(%(argtxt)s)' 

        __slots__ = () 

        _fields = %(field_names)r 

        def __new__(cls, %(argtxt)s):
            return tuple.__new__(cls, (%(argtxt)s)) 

        @classmethod
        def _make(cls, iterable, new=tuple.__new__, len=len):
            'Make a new %(typename)s object from a sequence or iterable'
            result = new(cls, iterable)
            if len(result) != %(numfields)d:
                raise TypeError('Expected %(numfields)d arguments, got %%d' %% len(result))
            return result 

        def __repr__(self):
            return '%(typename)s(%(reprtxt)s)' %% self 

        def _asdict(t):
            'Return a new dict which maps field names to their values'
            return {%(dicttxt)s} 

        def _replace(self, **kwds):
            'Return a new %(typename)s object replacing specified fields with new values'
            result = self._make(map(kwds.pop, %(field_names)r, self))
            if kwds:
                raise ValueError('Got unexpected field names: %%r' %% kwds.keys())
            return result 

        def __getnewargs__(self):
            return tuple(self) 

 N/A locals N/A N/A i name N/A enumerate field_names N/A N/A template N/A         %s = property(itemgetter(%d))
 N/A name i N/A verbose N/A N/A template N/A namespace N/A dict itemgetter _itemgetter __name__ N/A namedtuple_%s typename N/A N/A N/A template namespace N/A N/A N/A SyntaxError N/A e N/A N/A N/A SyntaxError N/A N/A N/A e message :
 template N/A result N/A namespace N/A typename N/A N/A hasattr _sys _getframe N/A N/A N/A result __module__ N/A N/A N/A N/A _sys _getframe 1 f_globals N/A __name__ N/A result N/A N/A N/A __name__ __main__ N/A cPickle loads dumps N/A Point N/A namedtuple Point x, y True N/A p N/A Point x 10 y 20 N/A N/A p N/A loads N/A dumps p Point N/A N/A namedtuple Point x y N/A N/A __slots__ N/A hypot N/A N/A self N/A N/A N/A N/A N/A N/A N/A self x 2 N/A N/A self y 2 0.5 N/A property __str__ N/A N/A self N/A N/A N/A N/A Point: x=%6.3f  y=%6.3f  hypot=%6.3f N/A N/A self x N/A self y N/A self hypot N/A N/A N/A p N/A N/A Point 3 4 N/A Point 14 N/A 5 7.0 N/A N/A p Point N/A N/A namedtuple Point x y N/A N/A Point class with optimized _make() and _replace() without error-checking N/A __slots__ N/A N/A _make N/A classmethod N/A tuple __new__ _replace N/A N/A self _map N/A map kwds N/A N/A N/A N/A self _make N/A _map N/A kwds get N/A x y self N/A N/A N/A N/A N/A N/A Point 11 22 _replace x 100 N/A Point3D N/A namedtuple Point3D N/A N/A Point _fields N/A z N/A N/A Point3D __doc__ N/A doctest N/A TestResults N/A namedtuple TestResults failed attempted N/A N/A TestResults N/A N/A doctest testmod