Skip to content

Commit 3656aa0

Browse files
committed
Removed trailing spaces on numerous lines.
1 parent 4007ac7 commit 3656aa0

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

flyweight.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
"""http://codesnipers.com/?q=python-flyweights"""
22

3-
import weakref
3+
import weakref
44

55

66
class Card(object):
77
"""The object pool. Has builtin reference counting"""
8-
_CardPool = weakref.WeakValueDictionary()
8+
_CardPool = weakref.WeakValueDictionary()
99

1010
"""Flyweight implementation. If the object exists in the
1111
pool just return it (instead of creating a new one)"""
12-
def __new__(cls, value, suit):
13-
obj = Card._CardPool.get(value + suit, None)
14-
if not obj:
15-
obj = object.__new__(cls)
16-
Card._CardPool[value + suit] = obj
17-
obj.value, obj.suit = value, suit
12+
def __new__(cls, value, suit):
13+
obj = Card._CardPool.get(value + suit, None)
14+
if not obj:
15+
obj = object.__new__(cls)
16+
Card._CardPool[value + suit] = obj
17+
obj.value, obj.suit = value, suit
1818
return obj
1919

20-
# def __init__(self, value, suit):
21-
# self.value, self.suit = value, suit
20+
# def __init__(self, value, suit):
21+
# self.value, self.suit = value, suit
2222

23-
def __repr__(self):
24-
return "<Card: %s%s>" % (self.value, self.suit)
23+
def __repr__(self):
24+
return "<Card: %s%s>" % (self.value, self.suit)
2525

2626

2727
if __name__ == '__main__':

0 commit comments

Comments
 (0)