v2.6 Primitive method Python code to add circle
The snippet you pasted relies on old API calls, and when it is run in a recent version of Blender it will produce the following exception / Error message 

TypeError: Converting py args to operator properties: : 
keyword "radius" unrecognized
Error: Python script fail, look in the console for now...


Bookmark this link www.blender.org/api/250PythonDoc/, it points at the latest docs automatically. You can also use the help menu.



See the current API page for bpy.ops.mesh.primitive_cone_add, You'll see that now (September 2015) must specify radius1 or radius2, radius doesn't exist anymore. And cap_end is now end_fill_type

Parameters:  

  - vertices (int in [3, 10000000], (optional)) – Vertices
  - radius1 (float in [0, inf], (optional)) – Radius 1
  - radius2 (float in [0, inf], (optional)) – Radius 2
  - depth (float in [0, inf], (optional)) – Depth
  - end_fill_type (enum in [‘NOTHING’, ‘NGON’, ‘TRIFAN’], (optional)) –
  - (....)


For the circle example you might use something like this.

import bpy

def makePrimitiveCircle(objName, v, r, f, loc, rot, layers=[0]):
    bpy.ops.mesh.primitive_circle_add(
        vertices=v, 
        radius=r, 
        fill_type=f, 
        view_align=False, 
        enter_editmode=False, 
        location=loc, 
        rotation=rot,
        layers=[(i in layers) for i in range(20)])
    ob = bpy.context.active_object
    ob.name = objName
    ob.show_name = True
    me = ob.data
    me.name = objName + 'Mesh'
    return ob

f = makePrimitiveCircle('pizza', 20, 1.2, 'NGON', (1,2,0), (0,0,0))
print(f)  # does return the new object
# &lt;bpy_struct, Object("pizza")&gt;  


# you could use this to specify layers directly..
makePrimitiveCircle('pizza', 20, 1.2, 'NGON', (1,2,0), (0,0,0), layers=[0,3,5])