On Friday, 17 February 2017 17:18:20 UTC+11, Travis Scrimshaw wrote: > > Hey Andrew, >> >> >> >> Yea, it comes from the fact that it is only a simple wrapped element and > doesn't do anything beyond forwarding the repr/latex/ascii-art outputs. I > go back and forth on whether or not to pass along some (all?) extra > methods. Probably the easiest thing to work with is the facade with the > ticket (at least if you don't care if the element belongs to this specific > parent). >
There's certainly an argument for passing magic methods along but then the question is where to you stop. One possibility would be to do something like: def __getattr__(self,attr): """ Any unrecognised method calls/attributes get passed on to the wrapped element """ try: return getattr(self,attr) except AttributeError: pass try: return getattr(self.value,attr) except AttributeError: raise AttributeError, '%s has no attribute %s\n'%(self,attr) Not sure what untended consequences something like this would have. Anyway, your ticket solves my problem so thanks for that! (and my wrapped elements know their parents so a facade is fine) Andrew -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-combinat-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-combinat-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-combinat-devel. For more options, visit https://groups.google.com/d/optout.