Softpedia
 


SCRIPTS CATEGORIES:



NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Koken 0.8.2
  • ContentBox 1.5.2
  • jQPlayer 0.5.2
  • SPOILER ALERT! 0.0.2
  • jQuery Mask Plugin 0.9.0
  • Easing Slider 2.1.2
  • Btapp.js 0.2.0
  • WiiFlash 0.4.5
  • Breeze.js 1.3.3
  • TinyMCE Templates 3.0.2
  • Home > Scripts > Programming Methods and Algorithms

    Named Tuples 1.9

    Download button


    Downloads: 618  Tell us about an update
    User Rating:
    Rated by:
    Fair (2.8/5)
    18 user(s)
    Developer:

    Website:

    License / Price:

    Platforms:

    Databases:

    Language:

    Last Updated:

    Category:
    Raymond Hettinger | More scripts
    aspn.activestate.com
    Other Free / Open Source License - Python License 

    Windows / Linux / Mac OS / BSD / Solaris
    N/A
    Python
    June 7th, 2007, 12:16 GMT
    C: \ Programming Methods and Algorithms

     Read user reviews (0)  Refer to a friend  Subscribe

    Named Tuples description

    Named Tuples script allows you a fast, lightweight attribute-style access to tuples.

    This script allows you a fast, lightweight attribute-style access to tuples. It contains a function that returns a new subclass of tuple with named fields.

    The principal features are:
    - Easy to type/read/modify function signature: NamedTuple('Person', 'name age sex height nationality') 
    - C-speed attribute lookup using property and itemgetter.
    - No instance dictionary means that instances take no more space than a regular tuple. 
    - Nice docstring is helpful with an editor's tooltips. 
    - Optional keywords in the contructor for readability and to allow variable order of specifying arguments: Person(name='susan', height=60, nationality='english', sex='f', age=30). 
    - Key/Value style repr for clearer error messages and for usability at the interactive prompt. 
    - Named tuples are picklable.
    - Clean error messages for missing or misnamed arguments. 
    - A method similar to str.replace() using a field name (used instead of slicing for updating fields -- instead of t[:2] newval t[3:], write t.replace('f',newval)).



    TAGS:

    tuples access | tuple subclass | tuple script | tuples | access | subclass

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM