Why is using 'C.object.data.uv_layers.remove()' in a loop not removing all UV layers? After hours of arguing with my code (Trying to eliminate some uv_layers), I'm trying this script directly in the console:
for uv in C.object.data.uv_layers:
    C.object.data.uv_layers.remove(uv)

This is producing unexpected results, including partial, but not complete, deletion of all uv_layers (Uv Map)
I would have expected all maps to be deleted.
In addition in some cases I get strange errors, with uv_layers names that are not even present in the C.object.data.uv_layers list.
I would like to be sure that we are talking about a bug, in this case I would eliminate the question right away.
If not, I'd like to know if I'm doing something wrong.
A simple test is to add a dozen or more uv_layers, manually, and run this code
The result:
Try a while loop.
Rather than looping thru a list you are removing from, it is often a better to make a copy of that list and pop and remove until list exhausted.
Using pop() is taking from the end of the list.
&gt;&gt;&gt; me = C.object.data
&gt;&gt;&gt; me
bpy.data.meshes['Suzanne']


&gt;&gt;&gt; uvlayers = me.uv_layers[:]
&gt;&gt;&gt; while uvlayers:
...     me.uv_layers.remove(uvlayers.pop())