Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Optimize CategoryObject.getattr_from_category()
Browse files Browse the repository at this point in the history
  • Loading branch information
jdemeyer committed Aug 31, 2016
1 parent a501048 commit 0fabb7a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/sage/structure/category_object.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -902,16 +902,16 @@ cdef class CategoryObject(SageObject):
cdef getattr_from_category(self, name):
# Lookup a method or attribute from the category abstract classes.
# See __getattr__ above for documentation.
if self._category is None:
# Usually, this will just raise AttributeError in
# getattr_from_other_class().
cls = type
else:
cls = self._category.parent_class

try:
return self.__cached_methods[name]
except KeyError:
if self._category is None:
# Usually, this will just raise AttributeError in
# getattr_from_other_class().
cls = type
else:
cls = self._category.parent_class

attr = getattr_from_other_class(self, cls, name)
self.__cached_methods[name] = attr
return attr
Expand Down

0 comments on commit 0fabb7a

Please sign in to comment.