joeyaurel / python-gedcom

Python module for parsing, analyzing, and manipulating GEDCOM files
https://gedcom.joeyaurel.dev
GNU General Public License v2.0
160 stars 39 forks source link

enhancement: return all_names #34

Open mameen opened 4 years ago

mameen commented 4 years ago

while the following snippet can return all names.. having it built in IndividualElement would help

all_names = [a.get_value() for a in individual.get_child_elements() if a.get_tag() == gedcom.tags.GEDCOM_TAG_NAME]
joeyaurel commented 4 years ago

@mameen Thank you for contributing! I know I have merged it already but shouldn't get_all_names() return a list of tuples containing the first and last name of the individuals?

Change in consideration:

all_names = [a.get_name() for a in individual.get_child_elements() if a.get_tag() == gedcom.tags.GEDCOM_TAG_NAME]

See the get_name() method: https://nickreynke.github.io/python-gedcom/gedcom/element/individual.html#gedcom.element.individual.IndividualElement.get_name

mameen commented 4 years ago

I agree this is the right way to do it.. I'm not actively working on it, but since this is my bad I can fix it, and update the tests.. do you want me to fix it, or will you take care of it? Thanks!