@@ -886,10 +886,17 @@ def __iter__(self):
886886 for group in unique_groups .values ():
887887 yield sorted (group , key = self ._ordering .__getitem__ )
888888
889- def get_siblings (self , a ):
890- """Return all of the items joined with *a*, including itself."""
889+ def get_siblings (self , a , * , include_self = True ):
890+ """
891+ Return all the items joined with *a*.
892+
893+ *a* is included in the list if *include_self* is True.
894+ """
891895 siblings = self ._mapping .get (a , [a ])
892- return sorted (siblings , key = self ._ordering .get )
896+ result = sorted (siblings , key = self ._ordering .get )
897+ if not include_self :
898+ result .remove (a )
899+ return result
893900
894901
895902class GrouperView :
@@ -905,11 +912,13 @@ def joined(self, a, b):
905912 """
906913 return self ._grouper .joined (a , b )
907914
908- def get_siblings (self , a ):
915+ def get_siblings (self , a , * , include_self = True ):
909916 """
910- Return all of the items joined with *a*, including itself.
917+ Return all the items joined with *a*.
918+
919+ *a* is included in the list if *include_self* is True.
911920 """
912- return self ._grouper .get_siblings (a )
921+ return self ._grouper .get_siblings (a , include_self = include_self )
913922
914923
915924def simple_linear_interpolation (a , steps ):
0 commit comments