get direct parent/get direct child/

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

get direct parent/get direct child/

Med Ouss
Question1:I want to know if x is a child of y, i couldn't get it , i used isSubclasses(x,parent) it returns true even when it's an indirect parent, and i want just a direct link , no matter if is child or is parent .. what matter is link between them,
Question 2 : is there any way to know if x and y are child of the same parent ?
Reply | Threaded
Open this post in threaded view
|

Re: get direct parent/get direct child/

Jiba
Administrator
Hi,

Q1: test if  "y in x.is_a"

Q2: get common parent using sets: set(x.is_a) & set(y.is_a)

Jiba