Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

dunder-getitem and get_list essentially the same #8

Open
chrrrisw opened this issue Dec 5, 2014 · 1 comment
Open

dunder-getitem and get_list essentially the same #8

chrrrisw opened this issue Dec 5, 2014 · 1 comment

Comments

@chrrrisw
Copy link
Contributor

chrrrisw commented Dec 5, 2014

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.

@amandasaurus
Copy link
Owner

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).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants