Hi! I had first asked the following question on sage-combinat-devel, but there was no reply, and so sorry for bothering you here...
It concerns two cached methods of categories, namely C.all_super_categories() and C.super_categories(proper=False). The former does not take any argument (except self); thus, one could easily replace it by a lazy attribute. The latter takes an argument which can be true or false; thus, one could easily replace it by two lazy attributes, say, C.super_categories and C.super_categories_proper. The question is: Shall we do such replacements? I vote "yes!", because a lazy attribute will always be faster than a cached method. Cached methods will hopefully soon be improved by #11115, but calling a cached method will still have an overhead compared with a simple attribute lookup. However, I have heard that methods are considered more pythonic than attributes. That's why I ask what you think about that topic. My counter-argument is: IMHO, currently both C.super_categories() and C.all_super_categories() are mainly for internal use - and I think that it is perfectly pythonic to internally work with attributes. The motivation of my question is #11943, where I accomplish a mission formulated by Nicolas: C.all_super_categories() should be ordered in the same way as C.parent_class.mro(). It turns out that #11943 would yield a mild speed regression when keeping super_categories and all_super_categories as (cached) methods, but yields a speed-up when replacing them by lazy attributes. Best regards, Simon -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org