How do I draw a parametric column or cylinder with varying radius using python
Using bmesh and screw

Make a simple bmesh edge on zx plane using poly function, then spin it around the z axis.  I've added a screw modifier to do the spinning, and commented out the bmesh spin operator.



import bpy
import bmesh
from math import radians

def poly(x):
    return   0.2 * x * x - x + 1.3

bm = bmesh.new()

# draw on zx plane
v0 = bm.verts.new((poly(0), 0, 0))
for dz in range(1, 100):
    z = dz / 50
    v = bm.verts.new((poly(z), 0, z))
    edge = bm.edges.new((v0, v))
    v0 = v
# could spin here I've added screw mod instead
#bmesh.ops.spin(bm, geom=bm.edges, axis=(0, 0, 1), angle=radians(360), steps=16) 

bpy.ops.mesh.primitive_cube_add()
ob = bpy.context.object
me = ob.data
bm.to_mesh(me)
me.update()   
# default screw modifier spins 360 on z
screw = ob.modifiers.new("Screw", 'SCREW')