Vertex -> Bone

Rigging yesterday, I was reminded of an idea I had a while back. A really helpful script would take selected vertices of a mesh in edit mode (or a vertex group), and create a single bone for each vertex.

Would someone be so kind as to help me out with this? (Or at least, where should a total noob start learning how to script something like this?)

Here you go:

import Blender 
from Blender import Armature, Object, Scene, Window 
# create new armature and link ot object / scene 
am = Armature.New('armature') 
ob = Object.New('Armature', 'armature') am ) 
scn = Scene.GetCurrent() ob ) 
am.makeEditable() #enter editmode 
# add bone for each vertex 
ob = Object.GetSelected()[0] # get the seletec object
me = ob.getData( mesh=1 ) 
for n in me.verts: 
    if n.sel: 
        pos = 
        eb = Armature.Editbone() 
        eb.head = pos 
        pos.y += 1.0 
        eb.tail = pos 
        #add the bone 
        am.bones['Bone%i' % n.index] = eb 
am.update()  #save changes 

That’s exactly what I needed – this is perfect! A million thanks, Loolarge!