Преглед изворни кода

Removed trailing spaces on numerous lines.

Jeroen пре 12 година
родитељ
комит
3656aa0f90
1 измењених фајлова са 12 додато и 12 уклоњено
  1. 12 12
      flyweight.py

+ 12 - 12
flyweight.py

@@ -1,27 +1,27 @@
 """http://codesnipers.com/?q=python-flyweights"""
 
-import weakref  
+import weakref
 
 
 class Card(object):
     """The object pool. Has builtin reference counting"""
-    _CardPool = weakref.WeakValueDictionary() 
+    _CardPool = weakref.WeakValueDictionary()
 
     """Flyweight implementation. If the object exists in the
     pool just return it (instead of creating a new one)"""
-    def __new__(cls, value, suit):         
-        obj = Card._CardPool.get(value + suit, None)         
-        if not obj:             
-            obj = object.__new__(cls)             
-            Card._CardPool[value + suit] = obj             
-            obj.value, obj.suit = value, suit          
+    def __new__(cls, value, suit):
+        obj = Card._CardPool.get(value + suit, None)
+        if not obj:
+            obj = object.__new__(cls)
+            Card._CardPool[value + suit] = obj
+            obj.value, obj.suit = value, suit
         return obj
 
-    # def __init__(self, value, suit):         
-    #     self.value, self.suit = value, suit      
+    # def __init__(self, value, suit):
+    #     self.value, self.suit = value, suit
 
-    def __repr__(self):         
-        return "<Card: %s%s>" % (self.value, self.suit)      
+    def __repr__(self):
+        return "<Card: %s%s>" % (self.value, self.suit)
 
 
 if __name__ == '__main__':