Looks like it might be a bug, check out _validate_encode_value (line 151) and _decode_value (line 205). The value gets converted to a str when set, but should be decoded to an int when you call get. http://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/api/memcache/__init__.py
Robert On Tue, Oct 12, 2010 at 06:55, 风笑雪 <[email protected]> wrote: > Hi, I found a problem when setting initial_value of memcache.incr() > and memcache.decr(). > > See this code: > ======== > from google.appengine.api import memcache > > memcache.delete('a') > memcache.incr('a', 1, initial_value=0) > print type(memcache.get('a')) > print (memcache.get('a')) > ======== > Result: > <type 'str'> > 1 > ======== > I think it should be <type 'int'> instead of <type 'str'>. Is it a bug? > > ---------- > keakon > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
