Created
March 24, 2014 16:30
-
-
Save fluffybeing/9743840 to your computer and use it in GitHub Desktop.
conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Jc2k> does parinx cache anything? the thought of constantly parsing docstrings in an app isnt a pleasant one. | |
* rocker has quit (Ping timeout: 246 seconds) | |
<rahulrrixe> Jc2k : I didn't notice the message early :( | |
<Jc2k> its ok :) | |
<rahulrrixe> Jc2k : no there is no caching in parinx | |
<rahulrrixe> can you suggest me how can i implement this feature | |
<Jc2k> rahulrrixe: perhaps if you had a Parser class so that the API looked like this: | |
<Jc2k> from parinx.parser import Parser | |
<Jc2k> parser = Parser() | |
<Jc2k> p.get_method_docstring(a_method) | |
<Jc2k> the parser object would have a self.cache = {} | |
<Jc2k> methods and objects can (irrc) be used as dictionary keys | |
<Jc2k> so get_method_docstring(method) could be: | |
<Jc2k> def get_method_docstring(self, method): | |
<Jc2k> if method in self.cache: | |
<Jc2k> return self.cache[method] | |
<Jc2k> # otherwise parse docstring and then | |
<Jc2k> self.cache[method] = |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment