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...

June 26, 2014

fun with dicts

A Python self invoking dict func. In the example below, whatever `self.mode`, it will call the two named functions if the input to `.get()` is in the dict keys(), else the lambda: None :)
{
    "input": self.input_mode,
    "output": self.output_mode
}.get(self.mode, lambda: None)()

No comments:

Post a Comment

Please use Blender.StackExchange.com for python scripting questions unrelated to this post.