import pygtk
pygtk.require("2.0")
from gi.repository import Gio

root = Gio.file_new_for_uri("file:///")

# get a set of file names by enumeration
filename_list_enumerated = set()
enumerator = root.enumerate_children(Gio.FILE_ATTRIBUTE_STANDARD_NAME, 0, None)
fileinfo = enumerator.next_file(None)
while fileinfo is not None:
    filename_list_enumerated.add(fileinfo.get_name())
    fileinfo = enumerator.next_file(None)

# get a set of file names by iteration
filename_list_iterated = set()
for fileinfo in root.enumerate_children(Gio.FILE_ATTRIBUTE_STANDARD_NAME, 0, None):
    filename_list_iterated.add(fileinfo.get_name())

# these should be identical
assert filename_list_enumerated == filename_list_iterated
