Created
August 26, 2011 09:04
-
-
Save zeffii/1173017 to your computer and use it in GitHub Desktop.
namedtuple example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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