edit is a Python module for use with the MacPython Integrated Development Environment (IDE). It allows you to type
>>> edit(foo)and an appropriate editor will be launched for foo, depending on its datatype. If foo is a string, a dialog box will pop up allowing you to edit the string in the proper Mac way; if it's a Numeric matrix, a spreadsheet-like matrix editor will appear; if it's nothing that can be so nicely edited, you'll at least get Just's cool object browser.
The edit system is modular and extendable; particular editors are stored in separate modules, but all accessed via one edit module (which knows how to locate and call the others as appropriate).
ArrayEditor.py | helper module for editmatrix.py (preliminary but cool!) |
---|---|
edit.py | main edit module (import this!) |
editmatrix.py | editor for 2D Numeric arrays |
editsequence.py | editor for Python sequences (not yet implemented) |
editbrowse.py | if all else fails, launches the object browser |
editstring.py | editor for short strings |
from edit import edit, editreturnThen, to edit some data 'foo', type "edit(foo)" to edit it in place (without returning the edited data), or "editreturn(foo)" to edit and return the new value.
Why the second function? It's needed for immutable types like strings. These can't be edited in place, so you'll need to do something like this:
foo = "bar" foo = editreturn(foo)But most other datatypes are mutable, so you can just say "edit(foo)" and be done with it.
0 | can't do anything with this data |
---|---|
1 | can display but not edit this data |
2 | can crudely edit this data |
5 | can reasonably edit this data |
8 | can edit this data quite well |
10 | ideal editor for this specific data |