[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Chaching version comparison and hash function



commit 281db911a5912836ceb63247b55d8f8300b639ec
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Tue Oct 8 09:11:48 2013 -0700

    Chaching version comparison and hash function
    
    Versions are intended to be read-only objects, so we might as well add caching
    for these methods.
---
 stem/version.py |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/stem/version.py b/stem/version.py
index 68faa36..613c4a5 100644
--- a/stem/version.py
+++ b/stem/version.py
@@ -187,6 +187,7 @@ class Version(object):
 
     return self.version_str
 
+  @lru_cache()
   def _compare(self, other, method):
     """
     Compares version ordering according to the spec.
@@ -247,6 +248,7 @@ class Version(object):
 
     return self._compare(other, lambda s, o: s >= o)
 
+  @lru_cache()
   def __hash__(self):
     my_hash = 0
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits