I have a depth first search algorithm that is pulling information from an Ontology.
I have a working function to get all of the objects with a particular property, however, I essentially need to do the same thing for a different property.
If I have these two simplified functions for example
def a():
for n in nodes:
do something with n.property1
def b():
for n in nodes:
do something with n.property2
Is there a way that I can pass the desired property in as a parameter? So that I end up with:
def a(property):
for n in nodes:
do something with n.property
a(property1)
a(property2)