pydanny/cached-property

Add a way to check if a property has already been cached

Open

#32 ouverte le 13 mai 2016

Voir sur GitHub
 (2 commentaires) (0 réactions) (0 assignés)Python (79 forks)github user discovery
enhancementhelp wanted

Métriques du dépôt

Stars
 (705 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

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?

Guide contributeur