Creating a mesh with Shading set to Smooth

I’m still getting used to the 2.5x API, and I’ve got a simple question.

I’m writing a script to create a mesh object from Python data, and I’d like the Shading to be set to smooth when the object is added to the screen.

I have a Python list of verts and faces, which I run through these commands to build a new mesh in the scene:

mesh ="Model")
object ="Model", mesh)
object.location = bpy.context.scene.cursor_location
mesh.from_pydata(verts, [], faces)

So far so good. But the mesh shows up with the default Flat shading, and I’d like it to be set to smooth. I know that the command (or a command, not sure if there are others) to set shading to smooth is bpy.ops.object.shade_smooth(). But I’m not sure where to put it in my code. I added it in at the end and it did nothing. Do I need to select my new object first? If so, how do I do that inside the script?

smoothings = []
smoothings.append(face.use_smooth)#smooth or flat in boolean
me_ob.faces.foreach_set(“use_smooth”, smoothings)#smooth array from face