PurgeLayer doesn't delete layers with objects in them

As discovered in this thread: How to delete a layer from GH? it appears that the PurgeLayer function is just a copy of the DeleteLayer function and does not in fact let you delete a parent layer with all its sublayers and objects in sublayers as described. It simply does nothing if any of the sublayers contain geometry.

In the documentation you can see someone obviously just copied the info for the DeleteLayer command without updating it properly, so probably the same has happened with the function itself.

Here is the contradictory part:

The Help may be copied incorrectly, but PurgeLayer does call different underlying code than DeleteLayer:

DeleteLayer:

def DeleteLayer(layer):
    layer = __getlayer(layer, True)
    return scriptcontext.doc.Layers.Delete( layer.LayerIndex, True)

PurgeLayer:

def PurgeLayer(layer):
    layer = __getlayer(layer, True)
    rc = scriptcontext.doc.Layers.Purge( layer.LayerIndex, True)
    scriptcontext.doc.Views.Redraw()
    return rc

( __getlayer is a helper function)

In a quick test here PurgeLayer() does work to delete layers with objects as well as layers that have sublayers with objects. It will not however purge a layer if it is current. Perhaps you can post an example of something that doesn’t work.