Python Script - Find all selected glyphs


I'm trying to write a simple python script that acts on the glyphs that the user has selected in the FontLab font window:

I'm especially interested in the glyphs (or maybe more accurately "glyph slots") that are in the encoding but are un-filled.

So far I've tried two things:

# 1 - glyph slots
selectedSlots = fl.count_selected
print "Number of selected glyph slots:", selectedSlots

# 2 - selected glyph names
selectedNames = [ fl.font.glyphs[i].name for i in range(len(fl.font.glyphs)) if fl.Selected(i) ]
print "List of selected glyph names:", selectedNames