Skip to content

Instantly share code, notes, and snippets.

@zeffii
Created August 26, 2011 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeffii/1173017 to your computer and use it in GitHub Desktop.
Save zeffii/1173017 to your computer and use it in GitHub Desktop.
namedtuple example
# http://docs.python.org/library/collections.html
# note to self
import collections
from collections import namedtuple
Robot = namedtuple('Robot', 'base, hinge1, arm_len, hinge2, wrist, hand')
Robot.base = 260
Robot.hinge1 = 20
Robot.arm_len = 120
Robot.hinge2 = 150
Robot.wrist = 90
Robot.hand = 0
# not an iterable.
print(Robot.hinge2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment