pydanny/cached-property
View on GitHubAdd a way to check if a property has already been cached
Open
#32 opened on May 13, 2016
enhancementhelp wanted
Repository metrics
- Stars
- (705 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
Sometimes it's useful to be able to check if a property has been cached already. Currently I'm using something like:
@cached_property
def cachable(self): pass
def a_function(self):
if 'cachable' in self.__dict__:
# Already cached.
else:
# Not cached yet.
(Haven't tested this, but I think it'ill work) Can we think of a better API?