The many ways of implementing xor... Incidentally, if there is some global switch to return certificates instead of booleans then the sum version is the correct one ;-)
On Saturday, August 20, 2016 at 11:51:42 AM UTC+2, William wrote: > > At Sage Days a new developer we're onboarding decided to look at some > code in Sage and ran into this: > > if sum([G.is_directed(), H.is_directed()]) == 1: > raise ValueError("One graph can not be directed while the > other is not.") > > This is line 551 of src/sage/graphs/generic_graph_pyx.pyx: > > > https://github.com/sagemath/sage/blame/master/src/sage/graphs/generic_graph_pyx.pyx#L551 > > > It seems to be equivalent to > > if G.is_directed() != H.is_directed(): > raise ValueError("One graph can not be directed while the > other is not.") > > Frankly, I'm really embarrassed about this code. What do you guys think? > > -- William > > > -- > William (http://wstein.org) > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.