Featured post

new redirect for blender.org bpy docs.

http://www.blender.org/api/blender_python_api_current/ As of 10/11 november 2015 we can now link to the current api docs and not be worr...

April 13, 2013

filling namedtuple from content of a dict

not surprisingly this just works.
# stakx.py
import collections
strs = ['one', 'two', 'three', 'four']
values = 1, 2, 3, 4
originals = dict(zip(strs, values))
file_params = collections.namedtuple('file_params', 'one two three four')
rfile_params = file_params(**originals)
print(rfile_params.one)
print(rfile_params.two)
print(rfile_params.three)
print(rfile_params.four)
view raw stakx.py hosted with ❤ by GitHub