Skip to content

Instantly share code, notes, and snippets.

@AaronPhalen
Last active September 24, 2015 05:17
Show Gist options
  • Save AaronPhalen/8de5f330c5004732ccbd to your computer and use it in GitHub Desktop.
Save AaronPhalen/8de5f330c5004732ccbd to your computer and use it in GitHub Desktop.
Python Collections Basic Examples
#Author: Aaron Phalen | Twitter: @aaron_phalen | Email: [email protected]
# Useful modules and examples from python's collections library
from collections import namedtuple
# 1. Python collections namedtuple
Parameters = namedtuple("Parameters", "x y z")
parameters = Parameters(x="1", y="2", z="3")
# Output
print parameters
# Parameters(x=1, y=2, z=3)
print parameters.x, parameters.y, parameters.z
# 1, 2, 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment