Search code examples
pythonparameterspython-3.xcurly-braces

Parameters with braces in python


If you look at the following line of python code:

bpy.ops.object.particle_system_add({"object":bpy.data.objects[2]})

you see that in the parameters there is something enclosed in braces. Can anyone tell me what the braces are for (generically anyway)? I haven't really seen this type of syntax in python and I can't find any documentation on it.

Any help is greatly appreciated. Thank you.


Solution

  • From the docs:

    Dictionaries can be created by placing a comma-separated list of key: value pairs within braces, for example: {'jack': 4098, 'sjoerd': 4127} or {4098: 'jack', 4127: 'sjoerd'}, or by the dict constructor.