[Tutor] bug or feature
Grant Hagstrom
grantahagstrom at gmail.com
Fri Jun 1 10:26:59 CEST 2007
A bug or feature in the IDLE of python 2.5?
pre-step: save the following file to your computer:
# file mylist.py
jobs = [
'Lions',
'SysTest',
'trainDD',
'Cats',
'train',
'sharks',
'whale',
]
Step 1.
copy, paste this script into the idle window. hit f5 to run.
thefile = open("mylist.py")
read_thefile = file.read(thefile)
string_thefile = str(read_thefile)
splitlist_thefile = string_thefile.split()
it_starts = splitlist_thefile.index('jobs')
Step 2.
open a new window. close the window from step one. close the shell from the
previous f5 execution.
Step 3.
paste and run this code.
thefile = open("/home/banter/Desktop/mylist.py")
read_thefile = file.read(thefile)
#string_thefile = str(read_thefile)
splitlist_thefile = string_thefile.split()
it_starts = splitlist_thefile.index('jobs')
Result: python remembers "string_thefile" even after both the shell and the
original scripting window have been closed!
bug or feature?
Best,
Grant
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070601/2486e930/attachment.html
More information about the Tutor
mailing list