Hello, I have a proposal to enhance the usefulness of Python for learning purposes. RFE#852222: I think that for learning Python, it would be nice to save the current namespace to a file using a builtin save() function (and corresponding load()). For beginning programmers, it would be nice to be able to tinker interactively with the shell, defining functions and maybe even classes, with which they can continue later on. save() is easily implemented by pickling locals(); load() is easily implemented by updating locals() while unpickling it. The functions would take a filename (string) as an argument. In Idle, they could be in the menu. Like the _ variable, load() and save() are only present in the interactive shell (some global .pythonrc?). Example usage: >>> def foo(): ... raw_input("Do you like it?" ) ... print "Great!" >>> save("~/session") >>> load("~/session") >>> foo() Do you like it? yes Great! Note that this code is untested. I think this would be a nice addition to Python 2.4. yours, Gerrit. -- 105. If the agent is careless, and does not take a receipt for the money which he gave the merchant, he can not consider the unreceipted money as his own. -- 1780 BC, Hammurabi, Code of Law -- Asperger's Syndrome - a personal approach: http://people.nl.linux.org/~gerrit/english/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4