Are there automatic indices for the various primitive meshes?

Hi all.
I know the standard command to add a primitive mesh (e. g. the cube):

bpy.ops.mesh.primitive_cube_add()

But I would like to know if there are predefined indices for the various types of mesh primitives. This would be useful in several situations, for example to randomize the type of primitive added to the scene.
I searched a lot in the Blender documentation and in the main forums/blogs, but did not find anything.
Do you have some tips to share? Is it necessary to handcraft a Python list?
Thanks

There is no index associated with the operators, but it’s easy to make a list and make a random selection from it.

import bpy
import random

primitive_cmds = [
    "primitive_plane_add",
    "primitive_circle_add",
    "primitive_uv_sphere_add",
    "primitive_ico_sphere_add",
    "primitive_cylinder_add",
    "primitive_cone_add",
    "primitive_torus_add",
    "primitive_monkey_add",
]

rng = 10

for i in range(rng):
    item = random.choice(primitive_cmds)
    cmd = f"bpy.ops.mesh.{item}()"
    eval(cmd)
    bpy.context.object.location.x = i * 2
1 Like

Perfect, as usual.
You are becoming my guru for Blender Python scripting. In this period I am studying quite hard to better understand the API and its applications, and your help is really precious.
Thanks.