]
Manik Surtani reassigned ISPN-1045:
-----------------------------------
Assignee: Galder Zamarreño (was: Manik Surtani)
Python client should have dictionary-like syntactic sugar
---------------------------------------------------------
Key: ISPN-1045
URL:
https://issues.jboss.org/browse/ISPN-1045
Project: Infinispan
Issue Type: Enhancement
Components: Hot Rod Client - Python
Affects Versions: 4.2.1.FINAL
Reporter: Manik Surtani
Assignee: Galder Zamarreño
Fix For: 4.2.2.BETA1
The Python Cache class uses Java Map-style put(), get(), remove() and contains(). Which
is fine, but we should also offer Python-style syntactic sugar, so that we can do:
{code}
cache['key'] = 'value'
print cache['key']
if 'key' in cache:
print 'Key exists!'
for e in cache:
print e
{code}
etc. Have a look at the implementation of a Python map for more details, or one of the
many custom map-like classes available for Python.
This is usually implemented by defining internal methods, such as:
{code}
def __getitem__(self, key):
return self.get(key)
def __setitem__(self, key, value):
self.put(key, value)
{code}
etc.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: