The setDefaultShadingGroup command is used to change which shading group is considered the current default shading group. Subsequently created objects will be assigned to the new default group. In query mode, return type is based on queried flag.
Derived from mel command maya.cmds.setDefaultShadingGroup
Example:
import pymel.core as pm
import maya.cmds as cmds
# Create a new blue shader
blinn = pm.shadingNode( 'blinn', asShader=True )
pm.setAttr( blinn+".color", 0.15, 0.35, 1.0, type='double3' )
blinnSG = pm.sets( renderable=True, noSurfaceShader=True, empty=True, name='blinnSG' );
pm.connectAttr( blinn+".outColor", blinnSG+".surfaceShader", force=True)
# Make it the default
pm.setDefaultShadingGroup( blinnSG )