Open chrrrisw opened 9 years ago
Perhaps you're right. Maybe x['FOO']
should always return a list. For things which there should only be one result (e.g. SEX
), you can write a custom property (like has been done). Then dunder-getitem would be a low-level data access approach for people familiar with GEDCOM, and we can add pythonic functions/properties for things of which make sense (i.e. hiding the how it is implemented in GEDCOM).
Hi, my changes to resolve the multiple names issue has essentially made dunder-getitem() and get_list() the same, except that dunder-getitem() returns either a list or a single object depending on the number of child elements. This made the client code in name() more complex as I had to check if a list or Element was returned. The name() method could use get_list() instead and if we were to add, say, a spouses() property, this would use the same mechanism. Or we could remove the get_list() method and always return a list from the dunder-getitem() method. This issue is mainly at the discussion stage - what do you see as the way forward? Cheers, Chris.