Python Shell – shell.appspot.com is acting weird? or am I missing something?
Google App Engine/1.3.0
Python 2.5.2 (r252:60911, Apr 7 2009, 17:42:26)
[GCC 4.1.0]
>>> mycolors = ['red','green','blue']
>>> mycolors.append('black')
>>> print mycolors
['red', 'green', 'blue']
But the below result is expected
['red', 'green', 'blue', 'black']
And also same with the dictionary data type.
Thanks,
Abhinay
Short Answer
That is a known bug. Short answer:
mycolors.append('black'); print mycolorsLong answer
The bug involves the way that state is stored in between every command you type. Web requests are stateless and request/response only; however the shell (and my console app) is supposed to feel like a stream of consciousness as it is at the traditional Python prompt.
The implementation is roughly this:
__main__with some variable bindings.