On Sat, May 23, 2009 at 06:19:35PM -0700, Nicolas Thiéry wrote: > Dear Craig, David, Mike, Robert: > > On Sat, May 23, 2009 at 10:01:47AM -0700, Nicolas Thiéry wrote: > > I'll also give it a shot at the getattr alternative implementation > > (as we had discussed), so that you can focus on reviewing. > > Done for the second one: see categories-getattr_hack-nt.patch that > I'll upload tonight to the sage-combinat patch server. > > IMHO, this is much hackier than inheriting dynamically from the > element or parent_class of the category. I am really not a fan of > using it, except when there are no other choices yet (extension > types). So it's up to you to make it rock solid and optimized!
I forgot to mention: the trick of setting __getattr__ in Sets().element_class (resp. Sets().parent_class) to avoid the double lookup does not work, because they are after Parent (resp. Element) in the mro. So we have to test in Parent.__getattr__ that the class of the object does not derive from Sets().parent_class (typically by testing that the class is not a dynamic class, which I do now). Or maybe we want to make sure that Sets().parent_class inherits from Parent (and idem for elements) Cheers, Nicolas -- Nicolas M. Thiéry "Isil" <nthi...@users.sf.net> http://Nicolas.Thiery.name/ --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---