By looking at order, this could work as expected!
Not certain for complex sequences like multiple active primary objects?

gramps/gen/db/ def _f(curs_):
gramps/gen/db/ iter_person_handles = _f(get_person_cursor)
gramps/gen/db/ iter_family_handles = _f(get_family_cursor)
gramps/gen/db/ iter_event_handles = _f(get_event_cursor)
gramps/gen/db/ iter_place_handles = _f(get_place_cursor)
gramps/gen/db/ iter_source_handles = _f(get_source_cursor)
gramps/gen/db/ iter_citation_handles = _f(get_citation_cursor)
gramps/gen/db/ iter_media_object_handles = _f(get_media_cursor)
gramps/gen/db/ iter_repository_handles = _f(get_repository_cursor)
gramps/gen/db/ iter_note_handles = _f(get_note_cursor)
gramps/gen/db/ iter_tag_handles = _f(get_tag_cursor)

gramps/gen/db/ def _f(curs_, obj_):
gramps/gen/db/ iter_people = _f(get_person_cursor, Person)
gramps/gen/db/ iter_families = _f(get_family_cursor, Family)
gramps/gen/db/ iter_events = _f(get_event_cursor, Event)
gramps/gen/db/ iter_places = _f(get_place_cursor, Place)
gramps/gen/db/ iter_sources = _f(get_source_cursor, Source)
gramps/gen/db/ iter_citations = _f(get_citation_cursor, Citation)
gramps/gen/db/ iter_media_objects = _f(get_media_cursor, MediaObject)
gramps/gen/db/ iter_repositories = _f(get_repository_cursor, Repository)
gramps/gen/db/ iter_notes = _f(get_note_cursor, Note)
gramps/gen/db/ iter_tags = _f(get_tag_cursor, Tag)

Note, even for private functions only, to use the same name is really confusing.


Le sam. 10 mai 2014 at 8:39, Vassilii Khachaturov <> a écrit :
On 09.05.2014 22:01, Jerome wrote:

By looking if I can fix some errors, I found maybe a possible major issue.

One method is set twice on gen/db/!

If there is no difference between:

def _f(curs_):
        Closure that returns an iterator over handles in the database.
        def g(self):
            with curs_(self) as cursor:
                for key, data in cursor:
                    yield handle2internal(key)
        return g

    def _f(curs_, obj_):
        Closure that returns an iterator over objects in the database.
        def g(self):
            with curs_(self) as cursor:
                for key, data in cursor:
                    obj = obj_()
                    yield obj
        return g

then this could be minor, 
but this could be also the cause of some recent bugs under 4.0.x!

Which one is the good one?

Things are evaluated in order of appearance. So if you have a

def foo(bar):
def foo(bar, baz):

then anything after the block will see the 2nd definition only, overriding the 1st and obliterating it forever. (Unless something aliases the 1st foo in betwen, e.g.
def foo(bar):
preserved_foo = foo
def foo(bar, baz):