Improve string representations
parent
190a548ab3
commit
1336dc164d
11
pylibmc.py
11
pylibmc.py
|
@ -113,6 +113,8 @@ class Client(_pylibmc.client):
|
|||
|
||||
If *binary* is True, the binary memcached protocol is used.
|
||||
"""
|
||||
self.binary = binary
|
||||
self.addresses = list(servers)
|
||||
addr_tups = []
|
||||
for server in servers:
|
||||
addr = server
|
||||
|
@ -135,6 +137,15 @@ class Client(_pylibmc.client):
|
|||
addr_tups.append((stype, addr, port))
|
||||
super(Client, self).__init__(servers=addr_tups, binary=binary)
|
||||
|
||||
def __repr__(self):
|
||||
return "%s(%r, binary=%r)" % (self.__class__.__name__,
|
||||
self.addresses, self.binary)
|
||||
|
||||
def __str__(self):
|
||||
addrs = ", ".join(map(str, self.addresses))
|
||||
return "<%s for %s, binary=%r>" % (self.__class__.__name__,
|
||||
addrs, self.binary)
|
||||
|
||||
def get_behaviors(self):
|
||||
"""Gets the behaviors from the underlying C client instance.
|
||||
|
||||
|
|
Reference in New Issue