Cylinder Script works in unexpected way.

I run this script to create a cylinder at an angle, centre the origin.

import bpy;
import math;
from math import *;
x=4
y=-2
z=-3
length=sqrt(z*z+y*y+x*x)
cog=length/2;
bpy.ops.mesh.primitive_cylinder_add(vertices=16, radius=0.01, depth=length, end_fill_type='NGON', view_align=False, enter_editmode=False, location=(0,0,0), rotation=(atan(y/x),atan(x/z),0));

I then set the translate orientation to LOCAL and drag on the blue arrow to move the cylinder so that it’s end is at the origin. This code appears in the log

bpy.ops.transform.translate(value=(-1.91222, 1.19514, 1.43417), constraint_axis=(False, False, True), constraint_orientation='LOCAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=True)

I tag this code to my original code

import bpy;
import math;
from math import *;
x=4
y=-2
z=-3
length=sqrt(z*z+y*y+x*x)
cog=length/2;
bpy.ops.mesh.primitive_cylinder_add(vertices=16, radius=0.01, depth=length, end_fill_type='NGON', view_align=False, enter_editmode=False, location=(0,0,0), rotation=(atan(y/x),atan(x/z),0));

bpy.ops.transform.translate(value=(-1.91222, 1.19514, 1.43417), constraint_axis=(False, False, True), constraint_orientation='LOCAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=True)


The result is not the same as what I got when I did the secodn step manually?

Can someone let me know how I achieve the translation through the origin in my script?

For the information of others, if I change the

constraint_axis=(False, False, True),

to

constraint_axis=(False, False, False), 

I fix this particular problem.

Although the api is good, I lack good definitions for what the parameters actually mean either mathematically or in plain language.