[code.view]

[top] / python / PyMOTW / collections / collections_namedtuple_rename.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2009 Doug Hellmann All rights reserved.
     #
     """
     """
     #end_pymotw_header
     
     import collections
     
     with_class = collections.namedtuple('Person', 'name class age gender', rename=True)
     print with_class._fields
     
     two_ages = collections.namedtuple('Person', 'name age gender age', rename=True)
     print two_ages._fields
     

[top] / python / PyMOTW / collections / collections_namedtuple_rename.py

contact | logmethods.com